Created
April 13, 2015 17:03
-
-
Save tburry/43d90c6fc56b87c1f7f2 to your computer and use it in GitHub Desktop.
An nginx configuration file for multiple Vanilla installations in one folder.
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 { | |
server_name vanilla.dev; | |
listen 80; | |
root /var/www/vanilla; | |
location ^~ /static { | |
access_log /dev/null; | |
error_log /dev/null crit; | |
alias /var/www/static/; | |
index index.html; | |
try_files $uri $uri/; | |
} | |
location ^~ /favicon.ico { | |
access_log off; | |
error_log off; | |
return 404; | |
} | |
location /pulse { | |
# Don't log pulse hits | |
access_log /dev/null; | |
error_log /dev/null crit; | |
return 200; | |
} | |
location /nginx/status { | |
# stub_status on; | |
access_log /dev/null; | |
allow 127.0.0.1; | |
deny all; | |
} | |
location /php/status { | |
# send to fastcgi | |
include fastcgi.conf; | |
fastcgi_pass php-fpm; | |
access_log /dev/null; | |
allow 127.0.0.1; | |
deny all; | |
} | |
# Safeguard against serving configs | |
location ~* "/\.htaccess$" { deny all; return 403; } | |
location ~* "/\.git" { deny all; return 403; } | |
location ~* "/conf/.*$" { deny all; return 403; } | |
# PHP handler | |
location ~* /([^./]+)/index\.php$ { | |
# send to fastcgi | |
include fastcgi.conf; | |
fastcgi_param NODE_SLUG $1; | |
fastcgi_param PHP_SELF $fastcgi_script_name; | |
fastcgi_param SCRIPT_FILENAME $document_root/index.php; | |
fastcgi_pass php-fpm; | |
} | |
# PHP | |
location ~* /cgi-bin/.+\.php { | |
# send to fastcgi | |
include fastcgi.conf; | |
fastcgi_pass php-fpm; | |
} | |
# Don't let any other php files run by themselves | |
location ~* \.php { | |
rewrite ^(/[^./]+)(/.*) $1/index.php?p=$2 last; | |
return 404; | |
} | |
# Redirect to the empty url to the hub site. | |
location ~ ^/$ { | |
rewrite ^ /hub permanent; | |
} | |
# Default location | |
location ~ ^(/[^./]+)(.*) { | |
try_files $2 @vanilla; | |
} | |
location @vanilla { | |
rewrite ^(/[^./]+)(.*) $1/index.php?p=$2 last; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment