Created
September 26, 2012 22:28
-
-
Save monkyz/3791032 to your computer and use it in GitHub Desktop.
nginx + fast cgi vhost for drupal
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; | |
server_name subdomain.domain.com; | |
access_log /home/user/drupal/logs/access.log; | |
error_log /home/user/drupal/logs/error.log; | |
client_max_body_size 6M; | |
root /home/user/drupal/public; | |
index index.php index.html index.htm; | |
location / { | |
error_page 404 index.php; | |
error_page 403 /403.html; | |
# the main drupal app | |
if (!-e $request_filename) { | |
rewrite ^/(.*)$ /index.php?q=$1 last; | |
} | |
} | |
# serve static files directly | |
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico)$ { | |
#rewrite ^/favicon.ico$ /sites/drupal-6.x/themes/mytheme/favicon.ico break; | |
access_log off; | |
expires 30d; | |
} | |
# imagecache needs to have php read any files that it's planning to manipulate | |
location ^~ /sites/all/files/imagecache/ { | |
index index.php index.html; | |
# assume a clean URL is requested, and rewrite to index.php | |
if (!-e $request_filename) { | |
rewrite ^/(.*)$ /index.php?q=$1 last; | |
break; | |
} | |
} | |
# serve the app via fastcgi | |
location ~ \.php$ { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_read_timeout 240; | |
include /etc/nginx/fastcgi_params; | |
} | |
# deny access to .htaccess files, if Apache's document root | |
# concurs with nginx's one | |
# | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment