Linux Harbour

Technology News of Linux & Open Source


Drupal and Nginx with PHP-FPM

When I migrate a drupal site to running on nginx with php-fpm, I will add the following config lines at nginx virtual host setting to allow static files (image files, document files, etc.) to bypass php-fpm. I use nginx variable $query_string to pass query to drupal.

location / {
try_files $uri $uri/ /index.php?$query_string;
location ~* ^.+\.(jpg|jpeg|gif|png|css|zip|pdf|txt|js|flv|swf|html|htm)$ {
client_max_body_size 64M;

And adding the following PHP custom settings to allow large file uploading.

memory_limit = 128M
upload_max_filesize = 64M
post_max_size = 64M

Above settings can be also used at ISPConfig 3.

Sammy Fung

Sammy is the founder of the Linux Harbour.