This is an old revision of the document!
# Get the latest package lists sudo apt-get update # Update the system to the latest sudo apt-get upgrade
sudo apt-get -y install nginx
sudo systemctl stop nginx.service sudo systemctl start nginx.service
sudo apt-get -y install php-fpm sudo systemctl enable php8.2-fpm sudo systemctl start php8.2-fpm
sudo vi /etc/nginx/sites-enabled/default
# Add index.php to the list if you are using PHP index index.php index.html index.htm index.nginx-debian.html;
# pass PHP scripts to FastCGI server # location ~ \.php$ { include snippets/fastcgi-php.conf; # # # With php-fpm (or other unix sockets): fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; # # With php-cgi (or other tcp sockets): # fastcgi_pass 127.0.0.1:9000; }
# deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /\.ht { deny all; }
sudo systemctl reload nginx.service
sudo vi /var/www/html/test.php
<?php phpinfo(); ?>