NGINX domain shows different directory?

Avatar forum:knide 6 months, 1 week ago

Hi All!

I just started with my linode, I'm still a noob but wanted to give it a go. I followed the linode LEMP documentation and I added 2 domains on my linode.



Now the weird thing is when I go to I can see the website normally. But now when I go to I can see the index.php file of

> I did a: tail /var/log/nginx/error.log and this is the result:

2018/02/12 20:57:11 [error] 14017#14017: *20 directory index of "/var/www/html/" is forbidden, client:, server:, request: "GET / HTTP/1.1", host: ""

So the above error log is showing that it's accessing the public_html folder of cloudening

But the Nginx virtual host settings for is:

server {
        listen 80;
        listen [::]:80;


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

        location / {
                try_files $uri $uri/ =404;
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                include fastcgi_params;
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name;

So it got me thinking that it might be on my domain manager, so what I did was I deleted the A record of hostname www and then added a cname of www that points to, but still did not work.

Now if I view and it shows the correct files/page.

And now if I go to it shows me the index.php file?

Your thoughts? Thanks!

1 Reply

Okay never mind, I fixed this by adding:


Hope this helps newbies like me.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct