I have moved away from using Thin to using Unicorn in production for a number of reasons
Some articles to convince you of the same thing.
- Unicorn is Unix
- Unicorn Power
- Most important for me was the ability of Unicorn master and worker processes to respond to Unix signals. This means, zero downtime deployments.
You need more convincing? Let me know and we can talk!
So with that out of the way, let’s see how you can configure nginx to work with unicorn.
- Install nginx via the package manager. (For AMI Ec2:sudo yum install nginx, For Ubuntu : sudo apt-get install nginx)
- Use this template for nginx unicorn configuration and then fill in only the required details.
- Note that the way it differs from thin configuration is by giving the server value as a location to the socket.
If you have unicorn correctly configured then start unicorn, restart nginx and you should be set.