Last active
December 16, 2015 18:39
-
-
Save dmouse/5479498 to your computer and use it in GitHub Desktop.
Nginx + PHP-FPM + Drupal, sample configuration file for nginx and Drupal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name site.com www.site.com ; | |
server_tokens off; | |
aio off; | |
directio off; | |
sendfile on; | |
gzip on; | |
proxy_read_timeout 900s; | |
fastcgi_read_timeout 900s; | |
client_max_body_size 10M; | |
access_log /var/log/nginx/site.com_access.log; | |
error_log /var/log/nginx/site.com_error.log; | |
location ~ /\.git { | |
deny all; | |
} | |
location ~ \.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$ { | |
return 403; | |
} | |
location ~ ^/private/ { | |
return 403; | |
} | |
location ~ ^/sites/default/files/private/ { | |
return 403; | |
} | |
location ~ ^/sites/default/config/ { | |
return 403; | |
} | |
location ~ /sites/default/files/.*\.php$ { | |
return 403; | |
} | |
location / { | |
root /var/www/vhosts/site.com/httpdocs; | |
index index.php; | |
try_files $uri $uri/ @rewrite; | |
expires max; | |
} | |
location @rewrite { | |
rewrite ^/(.*)$ /index.php?q=$1; | |
} | |
location ~ \.php$ { | |
root /var/www/vhosts/site.com/httpdocs; | |
#try_files $uri =404; | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_read_timeout 120; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment