I decided to switch to NGINX about a month ago. Two days ago, I switched back to Apache, here’s why I gave it a second chance.

Why I switched

The primary reason I made the switch to NGINX in the first place was because my VPS kept crashing, and I couldn’t figure out why. I tried all sorts of fixes to decrease the memory usage of Apache, and nothing worked, so I switched to NGINX. While this did end up reducing the frequency of the crashing. that was an indirect result. I later learned that the reason my VPS was crashing was because I was using and encrypted swapfile, which I disabled and changed to a regular swapfile. Although this does put a slight risk that a password stored in RAM will be swapped out, I doubt anyone will break into a datacenter, and run away with a server at the exact time a password is in the swapfile. I trust that Vultr has put reasonable effort into making stealing their expensive servers hard :) . Anyways, because NGINX uses significantly less RAM, it kind of reduced the problem. Now, after I fixed the issue, it’s time to give Apache another chance.

.htaccess files

A lot of WordPress plugins live off the .htaccess file,  a feature that’s not available in NGINX, or any other web server(ok, there’s actually the enterprise version of the LiteSpeed web server). htaccess files actually slightly decrease the performance, so I created a compromise with:

<Directory /var/www/nerdoflinux>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
        Include /var/www/nerdoflinux/.htaccess
</Directory>

which sort of helps with speed, and supports the .htaccess file that many plugins use(although changes require restarting Apache).

Support

If something goes wrong, it’s easier(in my opinion) to fix problems with Apache. This is in part due to the large community Apache has because it’s been around for so much longer than NGINX.

Now, if I had a powerful enough server(or multiple servers) I would use NGINX and Apache. NGINX would serve cached, static files, and Apache would handle PHP, allowing for .htaccess support, combined with the speed of NGINX.