tl;dr - Nginx or Apache for WP install, and WHY?
Which of these web server options are the best option for installing and sustaining a Wordpress instance? After reading dozens of articles and forum posts I’m leaning towards Nginx, but there may be some drawbacks as mentioned by @jsamuel, in [this discussion response](https://www.digitalocean.com/community/questions/why-is-apache-used-over-nginx-for-wordpress-one-click?
"It is possible to host WordPress using only Nginx without Apache at all, but because WordPress won’t be able to use .htaccess files (.htaccess files are an Apache feature, they don’t exist in Nginx), you’ll need to regularly be reconfiguring Nginx for various WordPress plugins. You should only take that approach if you’re comfortable with the command line and server administration."answer=31242/)
Is the ability to use .htaccess files still a concern if one was to use Nginx? Any clarification on this would be so helpful.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hey friend!
In terms of performance and sustaining high traffic, Nginx wins every time. It’s been that way for a while now, not quite one of those things that goes back and forth every month or so. Whether it’s a base install or both are tweaked for max performance, in any situation where it’s a 1:1 comparison, Nginx pulls ahead.
As for the .htaccess thing, I’m not sure I share the linked perspective. You need your basic rewrites and perhaps some additional ones to accommodate a good caching plugin. You should be able to find those in template form with light Google searching. Beyond that, I really have never met a plugin that wrote new items to .htaccess that I also recommended to people. There are a lot of very popular Wordpress plugins that I don’t like, and I think you can get along fine without. Security plugins being one of them. I’ll take http auth on wp-login any day, lightweight solution and additional security had by all.
Moving back to web server choices. There is, of course, more to life than benchmarks. When a visitor hits your page and it loads in an acceptable amount of time to not cause them to want to leave, performance is fine. As long as you’re not running Apache with Prefork MPM, most people see no issue based on the web server itself. I use Apache and Caddy, I never use Nginx. I know it’s the best, and I don’t use it. I just don’t like the configuration syntax. I don’t need it, it isn’t my preference, so I don’t use it. Caddy sytnax speaks to me:
domain.tld {
root /var/www/html
log /var/log/caddy/domain.log
errors /var/log/caddy/domain_errors.log
gzip
fastcgi / /run/php/php7.2-fpm.sock php {
ext .php
split .php
index index.php
}
}
So never forget that you have choices. Use what you want unless you need something else. Make it as enjoyable for you as it can be, you’re the one that has to wake up at 3AM and fix it so it might as well represent your style.
Jarland
Nginx has been the king for many years. Apache is far behind when it comes to scaling performance on high traffic Wordpress sites and Apache also has no server-level cache. Nginx has blazing fast FastCGI Cache which is built in and scales to incredible numbers…
Your quoted info is simply 100% wrong. Htaccess is not required for Wordpress or plugins to function correctly and actually it is a big security risk because any PHP script can hack your htaccess, which is a very common for malware redirects.
Cache plugins for Wordpress are a very bad idea these days, if you have Nginx FastCGI Cache then you simply don’t need any cache plugins which are bloated anyways and use PHP resources too (in contrast, the FastCGI cache in Nginx is server-level caching, which is lighter/faster).
Lately also Litespeed is bragging about their LS Cache and Apache drop-in replacement being “faster” than Nginx, but its totally bogus and Nginx is surely faster and more scalable than even Litespeed (which includes the janky htaccess stuff just like Apache does). Apache and Litespeed are really aimed at shared hosting and cPanel, which is their official partners too… high traffic sites use Nginx always.
Anyway clouds like DO usually include Apache on backend of Nginx LEMP stacks just for easier file permissions and to make it more user friendly for newbies who use Google tutorials etc.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.