Created
November 30, 2010 12:35
-
-
Save kvz/721617 to your computer and use it in GitHub Desktop.
A default Nginx config file that will server any (cake) php site in /var/www/*
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 _; | |
set $site $host; | |
if ($site ~ "^(w{3}\.)?(.*)$") { set $site $2; } | |
set $root /var/www/$site; | |
if (-d /var/www/www.$site) { set $root /var/www/www.$site; } | |
if (!-d $root) { rewrite ^(.*)$ http://decomissioned.plutonia.nl$1 break; } | |
if (-d $root/app) { set $root $root/app; } | |
if (-d $root/webroot) { set $root $root/webroot; } | |
access_log /var/log/nginx/$site.access.log; | |
root $root; | |
index index.html index.htm index.php; | |
if ($site = 'kvzlib.net') { | |
rewrite ^/b/(.+)$ /get.php?file=bash/programs/$1.sh last; | |
} | |
if (!-f $request_filename) { | |
rewrite ^/(.+)$ /index.php?url=$1 last; | |
break; | |
} | |
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |
location ~ (\.php|sitemap\.xml)$ { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_intercept_errors on; | |
include fastcgi_params; | |
} | |
location ~ ^/(favicon\.ico$|img|images|css|js|ccss|cjs) { | |
access_log off; | |
expires 370d; | |
add_header Cache-Control public; | |
} | |
# deny access to hidden | |
location ~ /\. { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment