Documentation

Setup the plugin for Nginx

Posted in: Getting Started (4) Plugin Options Explained (35) Actions / Filters (30) How To (14)   

This functionality is available for PRO version.

Most of servers run a LAMP stack (Linux + Apache + MySQL + PHP) which is very popular for being fast and easy to use. Any rewrite is done through the .htaccess file which is created within each site, in the domain root. The file is accessible from php, which imply WordPress and WP Hide plugin. When changing any options through plugin interface, the required rewrite data to re-map urls, is deployed automatically, the process does not require the user intervention.

Nginx is a different web server software, is now also used as a reverse proxy, HTTP cache, and load balancer. Generally Nginx is faster than Apache, it can serve faster static content, making it the optimal solution while using a WordPress Cache plugin. Also Nginx can handle lots more simultaneous connections on a low memory usage. Instead creating new processes for each web call, Nginx uses an asynchronous, event-driven approach where requests are processed in a single thread.

There are multiple ways to implement Nginx into a server. A common set-up is to set as reverse proxy for Apache. This deliver the features and power of Apache while still benefits of the Nginx speed. In such set-up the rewrite is still done through Apache .htaccess file, so the WP Hide core will be able to process and deploy automatically all required rewrite data, on a option change through the plugin interface.

Full Nginx Stack

When deploying Nginx as full stack, the install called LEMP ( Linux + Nginx + MySQL + PHP ). This is a very robust install which deliver outstanding speed and reliability for any Linux server. On Nginx, the rewrite data is required to be placed in specific config files. Compared to Apache, there isn’t a similar .htaccess file within the WordPress directory root to be used to place the lines. Also there isn’t direct access from php to edit the config files, which imply WordPress and WP Hide. So when change plugin options, a manual rewrite deployment operation is required. The process is easy and explained through plugin Setup interface :

In a nutshell the following steps are required:

  1. Change plugin options through the interface, accordingly to requirements.
  2. If rewrite data is required to be updated/changed on the server Nginx config file, the plugin puts a red mark at Setup menu item:
  3. Access the Setup interface and Copy the rewrite data provided through the first area ( ReWrite )
  4. SSH (connect ) into your server, preferably using Putty or any similar application. Locate the Nginx config file, this can be different from a server to another, depending on how it was configured. On vast majority this can be found at /etc/nginx/sites-available/your-domain.conf If you are not sure on the exact file, use the nginx -V command or ask your server administrator. We can also help if need assistance.
  5. Locate the line location / { and Paste the code right above it. If previous WP Hide rewrite has been addressed, those need first removed.
  6. Test if the above operation is successful: sudo nginx -t
  7. Restart the Nginx service sudo service nginx restart
  8. Return to Setup interface and click Confirm button:
  9. Clear site cache if use such plugin.

On certain servers, like Kinsta, WPEngine etc, there is no direct access to the server Nginx config file, this is done through Live Help area, the support representative will add the rewrite lines for you.

We can always provide assistance with plugin deployment and setup, if help needed, you just need to send a message through our contact form.

Video

The following video demonstrate the process per above steps, on a standard LEMP stack on Digitalocean.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
Scroll to top