Nginx Symfony 1.4 Configuration

We’ve been trying out nginx server for symfony 1.4 applications, the configuration can be a little bit tricky though… Here’s a working example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
server {
  listen 80;
 
  server_name yourdomain.com www.yourdomain.com;

  root /var/www/yourdomain.com/httpdocs/web;

  access_log /var/www/yourdomain.com/logs/access_log main;
  error_log /var/www/yourdomain.com/logs/error_log;

  index index.php;

  location / {
    try_files $uri $uri/ /index.php$uri?$args;
  }
 
  location ~ "^(.+\.php)($|/)" {
        fastcgi_split_path_info ^(.+\.php)(.*)$;
 
        fastcgi_param PHP_VALUE "error_log=/var/www/yourdomain.com/logs/error_log";
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_pass   127.0.0.1:9000;
        include        fastcgi_params;
    }

}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>