Created
October 12, 2011 18:23
-
-
Save ramlev/1282083 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 default; | |
server_name *.dev; | |
if ($host ~* "^(.+)+.dev$") { | |
set $site $1; | |
} | |
root /Users/Hasse/www/$site; | |
index index.php; | |
access_log /var/log/nginx/$host.access.log combined; | |
error_log /var/log/nginx/$host.error.log info; | |
# if the file is not physical there, loop trough drupal | |
if (!-e $request_filename) { | |
rewrite ^/(.*)$ /index.php?q=$1 last; | |
} | |
error_page 404 index.php; | |
# hide protected files | |
location ~* .(.htaccess|engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(.php)?|xtmpl)$|^(code-style.pl|Entries.*|Repository|Root|Tag|Template)$ { | |
deny all; | |
} | |
# if the file is not imagecached, create one | |
location ~/files/imagecache/ { | |
rewrite ^/(.*)$ /index.php?q=$1 last; | |
} | |
# hide backup_migrate files | |
location ~* ^/files/backup_migrate { | |
deny all; | |
} | |
# just send a n empty reponse if the favicon.ico is m.i.a. | |
location = /favicon.ico { | |
try_files /favicon.ico =204; | |
} | |
# enable robots.txt | |
location = /robots.txt {} | |
# serve static files directly | |
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ { | |
access_log off; | |
expires 30d; | |
} | |
# Allow all files in this location to be downloaded | |
location ~ ^.*/files/.*$ {} | |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
location ~ \.php$ { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
fastcgi_param PATH_INFO ""; | |
fastcgi_param PATH_TRANSLATED $document_root/$fastcgi_script_name; | |
fastcgi_param DOCUMENT_ROOT $document_root; | |
fastcgi_param QUERY_STRING $query_string; | |
fastcgi_param REQUEST_METHOD $request_method; | |
fastcgi_param CONTENT_TYPE $content_type; | |
fastcgi_param CONTENT_LENGTH $content_length; | |
fastcgi_param REQUEST_URI $request_uri; | |
fastcgi_param DOCUMENT_URI $document_uri; | |
fastcgi_param SERVER_PROTOCOL $server_protocol; | |
fastcgi_param GATEWAY_INTERFACE CGI/1.1; | |
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; | |
fastcgi_param REMOTE_ADDR $remote_addr; | |
fastcgi_param REMOTE_PORT $remote_port; | |
fastcgi_param SERVER_ADDR $server_addr; | |
fastcgi_param SERVER_PORT $server_port; | |
fastcgi_param SERVER_NAME $server_name; | |
fastcgi_param HOSTNAME $server_name; | |
fastcgi_connect_timeout 60; | |
fastcgi_send_timeout 180; | |
fastcgi_read_timeout 180; | |
fastcgi_buffer_size 128k; | |
fastcgi_buffers 4 256k; | |
fastcgi_busy_buffers_size 256k; | |
fastcgi_temp_file_write_size 256k; | |
fastcgi_intercept_errors on; | |
fastcgi_param REDIRECT_STATUS 200; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment