Sources nécessaire pour la dernière version de Nginx et PHP7
echo "deb http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list
echo "deb-src http://nginx.org/packages/mainline/debian/ jessie nginx" >> /etc/apt/sources.list
echo "deb http://packages.dotdeb.org jessie all" >> /etc/apt/sources.list
echo "deb-src http://packages.dotdeb.org jessie all" >> /etc/apt/sources.list
Ajouter les certificats
cd /tmp
wget http://nginx.org/keys/nginx_signing.key
wget https://www.dotdeb.org/dotdeb.gpg
apt-key add nginx_signing.key
apt-key add dotdeb.gpg
Installation et configuration des paquets
apt-get update
apt-get install nginx php7.0-mysql php7.0-fpm php7.0-curl
apt-get install mariadb-server mariadb-client
mysql_secure_installation
nano /etc/php/7.0/fpm/php.ini
nano /etc/nginx/nginx.conf
mv /etc/nginx/conf.d/default.conf /etc/nginx/default.conf.bak
Configurer NGINX
nano /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
root /var/www/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
systemctl restart nginx.service && systemctl restart php7.0-fpm.service
Tester PHP7 en créant une page de test et en donnant les droits à NGINX de les utilisers
mkdir -p /var/www/html
echo '<?php phpinfo(); ?>' > /var/www/html/index.php
chown -R www-data:www-data /var/www/
systemctl restart nginx.service && systemctl restart php7.0-fpm.service
Commentaires récents