Nginx : configuration pour site PHP Symfony

Boris HUISGEN January 30, 2012

administration hébergement nginx

server {
   listen        192.168.0.1:80;
   server_name   www.site.fr;
   root          /home/site.fr/web/;

   location / {
      index index.php;
      try_files $uri $uri/ /index.php?$args;
   }

   location ^~ /sf/ {
      alias /home/site.fr/lib/vendor/symfony/data/web/sf/;
   }

   location ~ "^(.+\.php)($|/)" {
      fastcgi_split_path_info   ^(.+\.php)(.*)$;
      fastcgi_param             SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param             SCRIPT_NAME $fastcgi_script_name;
      include                   fastcgi_params;
      fastcgi_pass              unix:/var/run/php-site_fr.sock;
      fastcgi_index             index.php;
   }
}

See also

Nginx : configuration reverse proxy pour serveur GlassFish
Read more
Nginx : rewrite rule avec paramètres
Read more
./GoAccess : analyseur de log Apache/Nginx temps réel
Read more