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
"After being hosted on GoDaddy for years, I didn't realize how negatively it was impacting my search traffic. Soon after moving to LittleBizzy, my homepage went from page 3 on Google to #1 world-wide for my target market, and I also reached the top 3 on Google Maps, with no additional SEO work."Juliette S.
"Before moving to LittleBizzy, whenever our news website was featured on the Drudge Report, it often slowed to a crawl or even froze up during big traffic spikes. Now, that never happens anymore, and we've been able to focus on publishing more articles instead of worrying about our web hosting."Tony H.
"The research by Amazon is definitely true, because our slow WooCommerce store was bleeding sales. After LittleBizzy stabilized our performance and moved us closer to our target customers, we saw a measurable improvement in shopping cart checkouts, esp. during holidays... much better!"Mohammed H.
No contracts, free migration, and free SSL forever. What are you waiting for? Order Hosting Now.
WordPress Gossip, Technical SEO News, And Other Goodies.
Free. Unsubscribe anytime.