Skip to content

Instantly share code, notes, and snippets.

@hackzilla
Created September 6, 2012 10:21
Show Gist options
  • Save hackzilla/3654449 to your computer and use it in GitHub Desktop.
Save hackzilla/3654449 to your computer and use it in GitHub Desktop.
Nginx Config for Symfony apps
server {
listen 80 default_server;
server_name _;
set $subdomain "default";
charset utf-8;
if ($host ~* "^(.+)\.(ukwm[0-9]{3}|local)$") {
set $subdomain $1;
}
root /Users/dan/Sites/$subdomain/web;
access_log /usr/local/var/log/nginx/$host.access_log;
error_log /usr/local/var/log/nginx/$host.error_log info;
# strip app.php/ prefix if it is present
rewrite ^/app\.php/?(.*)$ /$1 permanent;
location / {
index app.php;
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
location ~ \.php(/|$) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment