Skip to content

Instantly share code, notes, and snippets.

@symm symm/symfony.conf
Last active Oct 12, 2015

What would you like to do?
Nginx Symfony 2.1 vhost config
server {
listen 80;
root /www/;
error_log /var/log/nginx/yourdomain.error.log;
access_log /var/log/nginx/yourdomain.access.log;
# 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;
## Any other attempt to access PHP files redirects to the root.
location ~* ^.+\.php$ {
return 302 /;
## Aggressively cache assets. Be sure you have your assetic configured properly!
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
# pass the PHP scripts to FastCGI server listening on
location ~ ^/(app|config|app_dev)\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.