Skip to content
Advertisement

How to run PHP files properly on Ubuntu with Nginx?

I have “php” folder and also phpmyadmin folder in /var/www/html direction, and when I’m trying to open localhost/phpmyadmin/index.php or localhost/php/index.php in browser, I get the following error:

404 Not Found
nginx/1.10.3 (Ubuntu)

and also browser suggests me to download file.

I installed mysql, php 7.4, nginx and phpmyadmin aswell, have no idea why it isn’t working. I use Lubuntu distribution.

I guess it’s obvios, but I’m newby in linux and php topics, so any help is welcome 🙂

Advertisement

Answer

I’ve solved problem with 4 step from this article: https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04#step-1-install-the-nginx-web-server

Pay attention to result of this command (also from 4 step of article):

sudo nginx -t

In my case the result was:

root@joe-Vostro-1500:/home/joe# sudo nginx -t
nginx: [emerg] a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default:110

So I just did 4 step again and deleted all duplicates. That’s all.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement