So, you're on Nginx. That alone is an awesome move. As long as you're sure that everything you need is within Nginx, no need to load up on features that you won't use (from Apache).
Some of the things important to keep in mind about Nginx:
usual Nginx configuration file path: /opt/nginx/conf/nginx.conf
usual Nginx access log file path /var/log/nginx/access.log
usual Nginx error log file path /var/log/nginx/error.log
To Restart: sudo service nginx start
To Stop: sudo service nginx stop
To Reload: sudo service nginx reload
Because I encountered these problems, here are some tips I learned:
Tip #1
If you have this directive:
gzip_types text/plain text/css application/x-javascript application/xml application/xml+rss text/javascript;
just make sure that you remove text/html in the values you provide. gzip_types
already include text/html by default.
Tip #2
If you encounter any errors on binding to any ports, such as this:
[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use)
make sure that you kill all those connected to the port in question. You can either do:
sudo fuser -k 80/tcp
or
sudo killall nginx
before you start/restart nginx again.
Tip #3
When deploying a rails app, put
rails_env environment;
just replace environment
with whatever you call your environment: [development, staging, test, production, etc]
Sources:
- https://rtcamp.com/tutorials/nginx/troubleshooting/emerg-bind-failed-98-address-already-in-use/
- and my own debugging experience