Report this

What is the reason for this report?

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

Posted on December 20, 2019

How To Install Linux, Nginx, MariaDB, PHP (LEMP stack) on Debian 10_ https://www.digitalocean.com/community/questions/new?tags=LEMP%2CNginx%2CDebian+10

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

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

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

    server_name newpay191217.ml www.newpay191217.ml;

    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/newpay191217.ml /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
<?php
phpinfo();

http://www.newpay191217.ml

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

http://www.newpay191217.ml/info.php

404 Not Found


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Hello,

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! Regards, Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.