Skip to content

Instantly share code, notes, and snippets.

@Cosmicist
Created January 14, 2013 19:33
Show Gist options
  • Save Cosmicist/4532649 to your computer and use it in GitHub Desktop.
Save Cosmicist/4532649 to your computer and use it in GitHub Desktop.
Symfony2 nginx server config
server {
listen 80;
server_name symfony2;
root /var/www/symfony2/web;
error_log /var/log/nginx/symfony2.error.log;
access_log /var/log/nginx/symfony2.access.log;
location / {
index app.php;
if (-f $request_filename) {
break;
}
rewrite ^(.*)$ /app.php last;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ (app|app_dev).php {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param HTTPS off;
fastcgi_pass 127.0.0.1:9000;
}
}
server {
listen 443;
server_name symfony2;
root /var/www/symfony2/web;
ssl on;
ssl_certificate /etc/ssl/certs/symfony2.crt;
ssl_certificate_key /etc/ssl/private/symfony2.key;
error_log /var/log/nginx/symfony2.error.log;
access_log /var/log/nginx/symfony2.access.log;
location / {
index app.php;
if (-f $request_filename) {
break;
}
rewrite ^(.*)$ /app.php last;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ (app|app_dev).php {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param HTTPS off;
fastcgi_pass 127.0.0.1:9000;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment