How to switch to Nginx from Apache!

Posted March 19, 2018 13.4k views
NginxApacheUbuntu 16.04

Currently I am hosting my site on 8GB memory plan with Wordpress in ServerPilot,whenever my site hit 500+ visitors my CPU goes beyond 80% .

i)Is it normal for CPU to reach 80%+ whenever the visitors reaches 500+ in 8GB memory?

ii)I am searching for an answer to counteract this problem and I have read that NGinx is better than Apache for performance plus squeezing out more number of visitors,so I am planning to switch to Nginx but I have no idea how to get started .So far all the tutorials I have read speaks of installing Nginx in a newly created droplet not for switching from APache to Nginx.I have also contacted the serverpilot support team and they said “they cannot provide any assistance for an Nginx-only stack” ,well I am lost!

Will anybody kindly help me!! any good tutorial link on “how to switch from APache to Nginx” in a live site will be appreciated.

Thank you.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

I stopped using Apache w/ WordPress some years ago and have had no issues.

Keep in mind that there are some trade-offs that you will need to keep an eye out for. For example NGINX does not read your .htaccess file(s) so any plugins relying on this will not work entirely. I am not to sure if there is a way to change this functionality as I have not considered looking at this time.

You could consider an architecture change and run NGINX in front of Apache and leverage caching or look at using Varnish.

by Jesin A
This tutorial will show you how to configure Nginx as both a web server and as a reverse proxy for Apache – all on one Droplet. Depending on the web application, code changes might be required to keep Apache reverse-proxy-aware, especially when SSL sites are configured. To ensure this, we will install an Apache module named **mod_rpaf** which rewrites certain environment variables so it appears that Apache is directly handling requests from web clients.