Outils du site

La police, c'est un refuge pour les alcooliques qu'on n'a pas voulu à la SNCF et aux PTT. [Coluche]

04-linux:85-nginx

Ceci est une ancienne révision du document !


Table des matières

Nginx

Install

sudo apt install nginx

Install PHP

sudo apt install php7.2-fpm

Nginx utilise une socket pour accéder à PHP.

Configure php :

sudo vim /etc/php/7.2/fpm/pool.d/www.conf

Check listen = /var/run/php/php7.2-fpm.sock have the right socket path.

Dans la configuration de site PHP (/etc/nginx/sites-available/default) il faut vérifier que l'adresse de la socket est correcte :

        location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }

Check

systemctl status nginx

http://localhost

Check Nginx configuration :

sudo nginx -t

Manage

sudo systemctl stop nginx

sudo systemctl start nginx

sudo systemctl restart nginx

sudo systemctl reload nginx

By default, Nginx is configured to start automatically when the server boots. If this is not what you want, you can disable this behavior by typing:

sudo systemctl disable nginx

To re-enable the service to start up at boot, you can type:

sudo systemctl enable nginx

Dernière modification : 2019/02/11 01:25