Question

I cannot see files uploaded to ngnix website path

I upload my web site via dploy.io, I have provided /usr/share/ngnix/html as the path to upload files. Dploy tells me the file are successfully uploaded, but I cannot see them when I log as root (using putty). Yet, if I do a find / -name ‘world.html’ -print ubuntu tells me the file is there! yet, no amount of ls -la will show it, and oddly report 20 files while only 5 showing (including . and … entries). I destroyed and reinstalled the droplet many times trying different variations without success. I am not sure if it’s an Ubuntu or an Ngnix issue, or neither. Any help would be greatly appreciated. Thank you.

Here’s a paste of session interaction:

root@valcatraz:/usr/share/nginx/html# ls -la total 20 drwxr-xr-x 2 root root 4096 Jul 4 12:36 . drwxr-xr-x 3 root root 4096 Mar 24 12:11 … -rw-r–r-- 1 root root 537 Mar 4 2014 50x.html -rw-r–r-- 1 root root 618 Jul 4 12:36 index.html -rw-r–r-- 1 root root 20 Mar 24 12:12 info.php

root@valcatraz:/usr/share/nginx/html# find / -name ‘world.html’ -print /usr/share/ngnix/html/world.html

root@valcatraz:/usr/share/nginx/html#

Subscribe
Share

Submit an 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.

Ok, thanks, will follow your suggestion.

Well, if you look at my original post you can see that “ls -la” reports that there are 20 files and shows only 3, with no subdirectory at all (it’s out of the box, I haven’t installed these files, they were already there).

You can also see that when I ask “find” to search for “world.html” it says it’s found in usr/share/ngnix/html, although “ls” tells me otherwise…

And now, without me having done anything since last reply, “ls -la” reports only 12 files (no longer 20) and shows the same 3 that where already there.

Scratching my head…

Sadly everything was already like how you suggested, except the “autoindex on;” statement, but adding it hasn’t changed a thing.

How is it possible that the shell tells me there is 20 files there and show me only 3? I am no unix guru by any stretch of the imagination, but I have never seen anything like that. How cand “find” report the file, but not “ls”? :(

I just chose a droplet with every installed hoping to just have to put my files, but apparently there are some other steps I need to take, maybe it’s a security/user/group/etc thing that I have to set?

Welcome to DigitalOcean

We need to change the root

nano /etc/nginx/sites-available/default

or use your preferred text-editor

Change root to :

root  /usr/share/ngnix/html;

Change location / to :

  location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
        autoindex on;

    }

Save and restart nginx

service nginx restart

If it works click that hearth to show me some love :-)