This article is part of our Advanced Configuration Series. We will guide you through some of the more advanced web server capabilities of your Pagely VPS. We assume you are comfortable with using SSH command line and have a familiarity with NGINX configuration files. If you're ever unsure or need assistance getting something running under NGINX-only mode, our Support Team is just a few clicks away!
As outlined in our Guide to NGINX+Apache and NGINX-only modes, you have the option to make your site run without Apache and have NGINX interface directly with your PHP FPM workers. This feature unlocks a lot of possibilities for web server configuration and also boosts performance.
Before You Switch
Consider Testing On a Staging Site First.
Often times, our customers will start with creating a staging site to test things out there first. This is especially important if you have existing .htaccess rules to convert to NGINX configuration format.
.htaccess Rules
When a site is in NGINX-only mode, the .htaccess rules for your site will not be processed. If you have anything beyond the basic WordPress rules, you will want to have the rules converted to NGINX format before making the jump.
This is an example of a default .htaccess WordPress ruleset. If this is all you have, you can switch without further work as our default NGINX-only mode already handles this default case:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
If you have any other rules, such a redirects for forcing SSL or taking care of old links, we strongly recommend working on a staging copy of the site first. Our Support Team can assist with this cloning and conversion process.
Changing a Site to NGINX-Only Mode
It's very simple to switch your site to use NGINX-only mode! You can do this from within Atomic. It works on a per-site basis.
Changes are applied within a few seconds with little to no downtime (maybe a few seconds for uncached requests).
Switching back is easy too!
Connection Limits
NGINX-only mode configures a hard clamp on how many dynamic requests can be made at the same time. This is a self-stabilizing feature which is designed to briefly turn traffic away if the PHP FPM worker pool for your app is full of slow requests. Cached pages will still serve during these situations, and static assets are not affected by this limit. This manifests as 503 Service Unavailable responses.
This limit automatically scales up as you upgrade your plan to higher resource levels and it also automatically starts letting new requests through as soon as the slots starts to free up. With that said, this is the most common noticeable change in server behavior when switching to NGINX-only mode.
If you experience frequent 503 errors after switching to NGINX-only mode, these are most likely issues that were happening under the normal NGINX+Apache mode. We recommend switching back to the standard mode right away and contact us for further assistance. In NGINX+Apache mode, instead of fast 503s you would be seeing long waiting times for requests to complete.
Make sure to review our Optimization Guide next!
Additional Custom Rules
For any NGINX customizations beyond what is available in the Atomic interface, please contact our support team for assistance creating your custom rules.