I have done this in a fresh Debian installation on the server.
sudo apt install nginx
sudo systemctl start nginx
sudo systemctl status nginx
curl -sSL https://packages.sury.org/php/apt.gpg -o sury-php.gpg
sudo mv sury-php.gpg /etc/apt/trusted.gpg.d/
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt update
sudo apt upgrade
sudo apt install -y php8.2-fpm php8.2-common php8.2-mysql php8.2-xml php8.2-xmlrpc php8.2-curl php8.2-gd php8.2-imagick php8.2-cli php8.2-dev php8.2-imap php8.2-mbstring php8.2-opcache php8.2-soap php8.2-zip php8.2-intl
sudo service php8.2-fpm restart
sudo nano /etc/nginx/sites-available/example.com
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
root /var/www/example.com/public;
index index.html index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/example.com
sudo nginx -t
sudo systemctl restart nginx
now on /var/www/example.com/public
, I have created a dummy index.php file with echo Hello world.
Nothing showing in error and access log. How could I debug this? By the way on IP, it is showing the welcome nginx page, it could be because of fallback to the default server configuration. What I might be missing?