Skip to content

Instantly share code, notes, and snippets.

@hidenorigoto
Created December 25, 2011 15:25
Show Gist options
  • Save hidenorigoto/1519406 to your computer and use it in GitHub Desktop.
Save hidenorigoto/1519406 to your computer and use it in GitHub Desktop.
nginx Symfony2 example (subdirectory) WIP
server {
listen 80;
root /var/www/sitename;
server_name sitename;
index index.html index.php app.php;
if ($uri ~ \.(css|png|js|gif|jpg)$) {
break;
}
if ($uri !~ \/(app|app_dev)\.php) {
rewrite ^\/symfony-standard\/web\/(.*)$ /symfony-standard/web/app.php/$1 last;
}
location /symfony-standard/web/ {
if (-f $request_filename) {
break;
}
}
location ~ \.php(\/|$) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment