I finally got my rails server up and running on CentOS with Nginx and unicorn. But I noticed the each time the server reboots or power cycles, I have to run “service nginx start” manually and then go into each site and run “unicorn_rails -c config/unicorn.rb -D” for the site(s) to come up. Is there a way to automate this process when the server boots up?
Thank you
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
On CentOS, to ensure that nginx starts on reboot run: <pre> sudo chkconfig --levels 235 nginx on </pre> Then for Unicorn to start on boot, you’d need to write an init script and save it to <code>/etc/init.d/unicorn</code> Here’s an example one:
https://gist.github.com/mustafaturan/2762372
Make sure to change the variables at the top of the file to match your project. You’ll then be able to start and stop your app with: <pre> service unicorn stop service unicorn start </pre> And to make it run on boot, set: <pre> sudo chkconfig --levels 235 unicorn on </pre>
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.