Nginx is taking over the internet, literally. The top 1000 websites measured by Alexa are nearly all running on Nginx as the days of Apache (with cPanel, usually) server dominance quickly come to an end. The truth about modern web servers like Nginx is that they don’t really need to be “optimized” very much. In fact, I would go so far as to say that “over-optimization” is probably one of the most common issues I see among website administrators these days. That being said, there are still some basic configuration items that should be addressed when setting up an Nginx VPS or server, and the most important file involved is
/etc/nginx/nginx.conf on Ubuntu servers, although the location can (rarely) vary.
Like everything else related to server and network administration, these Nginx configuration settings are constantly evolving and often debated amongst programmers and system administrators. That being said, I’ve tried to include as many popular configuration options as possible along with recommended settings and an explanation of each one. Keep in mind that many Nginx configuration “recommendations” you might come across on blogs are in fact already enabled by default, so there is no need to re-specify them here in the Nginx configuration file (plus, this runs the risk of becoming outdated or inaccurate with each new Nginx version). I welcome any feedback or configuration suggestions for Nginx in the comments section.
sudo nano /etc/nginx/nginx.conf
After you’ve opened the Nginx configuration file using the command above, paste the below into it:
Last updated 2 May, 2016 and optimized for Ubuntu 14.04 LTS + CloudFlare.
After making any Nginx configuration changes, be sure to first “test” and then restart Nginx:
sudo nginx -t
sudo service nginx restartLast modified: 2 May, 2016
WordPress Gossip, Technical SEO News, And Other Goodies.
Free. Unsubscribe anytime.