Created
May 24, 2012 14:27
nginx multi-project based on base-path
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 443; | |
server_name mysuperserver; | |
location /project1 { | |
} | |
location /project2 { | |
} | |
} | |
#Project1 server | |
server { | |
server_name project1; | |
root /var/www/project1; | |
if (!-e $request_filename) { | |
rewrite ^/(.+)$ /index.php?url=$1 last; | |
break; | |
} | |
location ~ index\.php$ { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_intercept_errors on; # to support 404s for PHP files not found | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include /etc/nginx/fastcgi_params; | |
} | |
location ~* \favicon.ico$ { | |
access_log off; | |
expires 1d; | |
add_header Cache-Control public; | |
} | |
} | |
#Project2 server | |
server { | |
server_name project2; | |
root /var/www/project2; | |
if (!-e $request_filename) { | |
rewrite ^/(.+)$ /index.php?url=$1 last; | |
break; | |
} | |
location ~ index\.php$ { | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_intercept_errors on; # to support 404s for PHP files not found | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include /etc/nginx/fastcgi_params; | |
} | |
location ~* \favicon.ico$ { | |
access_log off; | |
expires 1d; | |
add_header Cache-Control public; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment