Step 5 — Creating a PHP File to Test Configuration, Show 404 Not Found

Posted December 20, 2019 2.5k views
Debian 10

How To Install Linux, Nginx, MariaDB, PHP (LEMP stack) on Debian 10_

Above is OK.
Step 4 — Configuring Nginx to Use the PHP Processor
My_domain is “”

$ sudo mkdir /var/www/
$ sudo chown -R $USER:$USER /var/www/
$ sudo nano /etc/nginx/sites-available/
server {
    listen 80;
    listen [::]:80;

    root /var/www/;
    index index.php index.html index.htm;


    location / {
        try_files $uri $uri/ =404;

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
$ sudo ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
$ sudo nginx -t
$ sudo systemctl reload nginx

Step 5 — Creating a PHP File to Test Configuration, Show 404 Not Found

$ nano /var/www/your_domain/info.php

Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

404 Not Found
edited by MattIPv4

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


There are a few things that I could suggest:

  • First make sure that your /var/www/your_domain/ folder is owned by the Nginx user. To do that first check what the Nginx user is:
sudo ps aux | grep -i nginx

Then get the user and run this command:

chown -R THE_NGINX_USER:THE_NGINX_USER /var/www/your_domain
  • If this does not help make sure to check your Nginx error log:
tail -100 /var/log/nginx/error.log

Feel free to share any errors here so that I could try to advise you further.

Hope that this helps!