Skip to content

Instantly share code, notes, and snippets.

@Theaxiom
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Theaxiom/acaf2f4126ce4c85cf03 to your computer and use it in GitHub Desktop.
Save Theaxiom/acaf2f4126ce4c85cf03 to your computer and use it in GitHub Desktop.
nginx alias php config
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;
}
}
@Theaxiom
Copy link
Author

Theaxiom commented Dec 4, 2014

Anyone have a better solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment