1. Home
  2. cPanel
  3. Nginx configuration in Proxy mode with SSL

Nginx configuration in Proxy mode with SSL

In this article we list steps of basic Nginx configuration, in PROXY mode, with SSL. Nginx works as SSL terminator and proxies all requests to Apache port 80. In this recommended mode SSL certificate has to be installed in advance via cPanel SSL function.

If you do not intend to use SSL, then read how to configure Nginx in non-SSL Proxy mode.

Why Nginx in proxy mode with SSL

In order to improve web site loading speeds for our shared cPanel customers, RedyHost implemented high performance stack using Nginx.

Nginx caching modes

Refer to this article if you need to configure Nginx caching or microcaching your website.
Nginx works in two different modes, allowing to proxy requests to Apache (and cache static files) or to serve PHP scripts directly, bypassing slower Apache web server completely. In both cases Nginx supports Google’s famous mod_pagespeed module, allowing to compress and minify web page size. mod_pagespeed is configured in core filters mode to avoid compatibility issues with different CMS and website types. Core filters proven to work great for 99.99% of use cases, reducing page size and number of connections for up to 3x times.

Note! For compatibility and security reasons RedyHost recommends to run Nginx in Proxy mode. By default, for all new accounts, Nginx is configured in Proxy mode.

Configuring Nginx

To access Nginx configuration
– login to cPanel and click XtendWeb Nginx control link

Configuring a domain in Nginx Proxy mode with SSL

In such configuration we recommend that you disable any SSL redirection functions in Apache.

Apache will listen on non-SSL port and no SSL functions or redirects should be enabled in Apache, .htaccess file or in plugins of your website.

Drupal specific instructions to disable SSL redirection

If you run Drupal, you will have to disable securepages module, or your website will not load.

For Drupal 7, add the following to your settings.php file

$conf["https"] = TRUE;
$base_url = "https://[your-website-full-url]"; // Do not add / at the end.

 

If you have redirection to www. in your .htaccess file, make sure the $base_url variable includes www. in the URL of your website.

Configuring Nginx as SSL terminator in Proxy mode

  1. Click Nginx link (see above)
  2. Select domain to manage and click Configure button

  3. Enable redirect to SSL option as in this screenshot and submit your changes

  4. Check your website is operational via SSL (https://yourdomain.com). If your website does not load due to a redirect loop, reconfigure Nginx to disable the ‘redirect_to_ssl’. To reconfigure Nginx, click the XtendWeb logo in the top of the page (see the above screenshot)

Updated on 26 July, 2017

Was this article helpful?

Related Articles