Chez ouam

/home/jmfrouin

View on GitHub
2 January 2013

Configurer nginx avec php sous Debian Squeeze

by Jean-Michel Frouin

Il faut installer php5-fpm :

apt-cache show php5-fpm

Package: php5-fpm
Source: php5
Version: 5.3.14-1~dotdeb.0

Pour cela il faut, ajouter les dépôts dotdeb. Dans le fichier /etc/apt/sources.list :

deb http://packages.dotdeb.org stable all

Un petit update : sudo apt-get update

Et on installe php5-fpm : sudo apt-get install php5-fpm

Dans le fichier vhost :

server {
listen 80;
server_name blog.frouin.me;
root /var/www/blog;
access_log /var/log/nginx/blog.frouin.me_access.log;
error_log /var/log/nginx/blog.frouin.me_error.log;
location / {
index index.php;
}

location ~ \.php {
include php_fastcgi_params;
fastcgi_pass @php5-backend;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SERVER_NAME $http_host;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

Avec dans le fichier /etc/nginx/conf.d/00-upstream.conf :

upstream @php5-backend {
server unix:/var/run/php5-fpm.sock;
}

tags: