Difference between revisions of "Nginx: Manual"

(No difference)

Latest revision as of 16:51, 27 October 2019

Nginx + PHP 7.3 (for Debian 10)

apt install nginx php-fpm

edit /etc/nginx/sites-available/default

server {

        listen 80;
        listen [::]:80;
        root /var/www/html;
        index index.php;
        charset utf-8;
        server_name example.com;
        access_log /var/log/nginx/example_com-access.log;
        error_log /var/log/nginx/example_com-error.log;

  location ~ \.php$ {
        root /var/www/html;
        fastcgi_read_timeout 61;
        try_files $uri $uri/ =404;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;


Test PHP + Nginx.

nginx -t
service nginx restart

Create file index.php with phpinfo();

nano /var/www/html/index.php