Top Nav

Archive | Nginx

Increase Nginx Upload Limit On Server With Plesk Panel

From the Plesk Panel you can set the PHP upload_max_filesize at Website & Domains -> PHP Setting. But if you’re using Nginx then you may also need to configure Nginx to allow larger uploads. We saw errors like this in the /var/log/nginx/error_log:

To resolve the issue edit /etc/nginx/nginx.conf and set client_max_body_size by adding the highlighted line:

 

1

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.

1

Score An “A” On SSLLabs Server Test

Want an A on the SSLLabs server test?

https://www.ssllabs.com/ssltest/

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:

https://community.qualys.com/blogs/securitylabs/2013/08/05/configuring-apache-nginx-and-openssl-for-forward-secrecy 

This forum post provided the WHM/Cpanel config:

http://forums.cpanel.net/f185/cpanel-openssl-1-0-1c-higher-332001-p3.html#post1561101

 

0

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:

http://www.if-not-true-then-false.com/2011/install-nginx-php-fpm-on-fedora-centos-red-hat-rhel/

To support WordPress I added the following line  into /etc/nginx/sites-enabled/acme.com.conf:

 

0

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:

http://nginx.org/en/docs/http/server_names.html

2