Top Nav

Archive | Nginx

Fixing “504 Gateway Timeout” Errors On Plesk With Nginx

If your Plesk server is configured to run Nginx in from of Apache then you may encounter “504 Gateway Timeout” errors when executing long running PHP pages.  Nginx is acting as a reverse proxy for Apache. The “proxy_read_timeout” configuration setting in Nginx controls how long Nginx will wait for Apache to return a response. The default is 60 seconds which may be too short if you have a script that takes several minutes to run. To increase this timeout, just edit /etc/nginx/nginx.conf and add the highlighted line:

Don’t forget to restart Nginx after making the change.


Score An “A” On SSLLabs Server Test

Want an A on the SSLLabs server test?

For Plesk create a file here:

and add the following:

For WHM/CPanel do this:

a. go to Service Configuration -> Apache Configuration -> Global Configuration and set “SSL Cipher Suite” to:

b. go to Service Configuration -> Apache Configuration -> Include Editor -> Pre Main Include and add the following lines:

For a standalone Apache server try these:

For Nginx try these lines:

If you get capped at a B due to TLS Compression support you can add:

For older Apache versions this setting may not be available. In this case you can edit the init script (/etc/init.d/httpd) and add this line:

Qualys has a blog post on this subject which provided the Apache and Nginx configs: 

This forum post provided the WHM/Cpanel config:



CentOS / Nginx / PHP-FPM / WordPress

Some quick notes on building a CentOS server with Nginx, PHP-FPM and WordPress.

First here’s great tutorial that covers the different Fedura / CentOS / RedHat versions:

To support WordPress I added the following line  into /etc/nginx/sites-enabled/



ServerAlias On Nginx

On Apache web servers, each virtual host has a “ServerName” directive and zero or more “ServerAlias” directives. When converting to Nginx there is only one directive – “server_name” which takes the place of both of the Apache directives. The “server_name” directive takes a set of space delimited arguments listing domains that should match the virtual host. So for example if you have this Apache config:

Then for Nginx use:

This is a simple example for full details see this page in the Nginx documentation:


Canonical Rewrite Rule For Nginx

Need to redirect from to with nginx? No problem … just add a virtual host declaration for the non-www that redirects like this:

or if you want to add to an existing vhost: