Created
April 3, 2015 14:26
-
-
Save bserem/ebe1e249da6a18a280d2 to your computer and use it in GitHub Desktop.
Nginx server block for running a Drupal workshop. This is not considered fast of secure, it is for development purposes.
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 8080; | |
server_name localhost; | |
root /var/www/workshop/drupal; | |
index index.php; | |
access_log /var/www/workshop/access.log; | |
error_log /var/www/workshop/error.log; | |
location = /favicon.ico { | |
log_not_found off; | |
access_log off; | |
} | |
location / { | |
# This is cool because no php is touched for static content | |
try_files $uri @rewrite; | |
} | |
## Drupal 7 generated image handling, i.e., imagecache in core. See: | |
## https://drupal.org/node/371374 | |
location ~* /sites/.*/files/styles/ { | |
access_log off; | |
expires 30d; | |
try_files $uri @rewrite; | |
} | |
# Fighting with ImageCache? This little gem is amazing. | |
location ~ ^/sites/.*/files/imagecache/ { | |
try_files $uri @rewrite; | |
} | |
location @rewrite { | |
# Some modules enforce no slash (/) at the end of the URL | |
# Else this rewrite block wouldn't be needed (GlobalRedirect) | |
#rewrite ^/(.*)$ /index.php?q=$1&$args; | |
rewrite ^ /index.php last; | |
} | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_intercept_errors on; | |
fastcgi_pass unix:/run/php-fpm/php-fpm.sock; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment