Last active
August 29, 2015 14:10
-
-
Save Theaxiom/acaf2f4126ce4c85cf03 to your computer and use it in GitHub Desktop.
nginx alias php config
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 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
# rewrite ^(.*) http://localhost$1 permanent; | |
root /var/www; | |
index index.php index.html index.htm; | |
# Make site accessible from http://localhost/ | |
server_name localhost; | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $request_filename; | |
include fastcgi_params; | |
} | |
location /blog { | |
alias /var/www/projects/blog/app/webroot/; | |
location ~ \.php$ { | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $request_filename; | |
include fastcgi_params; | |
} | |
} | |
location / { | |
try_files $uri $uri/ =404; | |
} | |
#error_page 404 /404.html; | |
location ~ /\.ht { | |
deny all; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Anyone have a better solution?