Skip to content

Instantly share code, notes, and snippets.

@henter
Last active December 25, 2015 10:39
Show Gist options
  • Save henter/6963716 to your computer and use it in GitHub Desktop.
Save henter/6963716 to your computer and use it in GitHub Desktop.
symfony2 nginx conf
server {
listen 80;
listen [::]:80 default_server ipv6only=on;
root /path/to/sfproject/web;
# Make site accessible from http://localhost/
server_name sf.cc localhost;
error_log /var/log/nginx/sf.error.log;
access_log /var/log/nginx/sf.access.log;
rewrite ^/app_dev\.php/?(.*)$ /$1 permanent;
location / {
index app_dev.php;
# try to serve file directly, fallback to rewrite
try_files $uri @rewriteapp;
}
location @rewriteapp {
# rewrite all to app.php
rewrite ^(.*)$ /app_dev.php/$1 last;
}
location ~ ^/(app|app_dev|config)\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
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