1

Please, help me resolve a problem, when Nginx always returns 404 for main directory.

So here sites-available/dev.vshvetsov.ru config%

server {
    listen 80;

    server_name dev.vshvetsov.ru;

    location / {
            proxy_pass http://127.0.0.1:8001;
            access_log /var/log/nginx/dev.vshvetsov.ru-access.log;
    }

    location ~* ^.+\.(css|js|png|gif|jp[e]?g|swf|svg|woff|eot|ttf|cur|map|txt|pdf)$ {
            root /vault/development/dev.vshvetsov.ru/htdocs;

            #access_log off;

            expires 30d;
    }
}

So what i've already done:

  1. Made an A-record for my IP and it works
  2. Made a reference ln -s to sites-enabled/
  3. Created root directory
  4. Restart and reload NGINX
  5. Tried to add root path/to/htdocs; and index index.html in Location / {} settings;
  6. Set the htdocs access mode recursive 777

When i'm trying to open dev.vshvetsov.ru I see the 404. But if I try to open dev.vshvetsov.ru/data/ingredients/1.txt I get the file contents

Here is the access.log record of my error

109.188.124.16 - - [02/Sep/2016:18:54:32 +0300] "GET / HTTP/1.1" 404 345 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7"

Thank you all, who will try to resolve it with me!

Best Regards

2
  • This doesn't look like an nginx error page. Check your web application. Sep 2, 2016 at 17:50
  • Michael, thank you! My index.html in htdocs at this moment contains only "Hello World" with !DOCTYPE, html and body. Sep 2, 2016 at 19:02

1 Answer 1

0

You are passing all requests to your web application server with proxy_pass, which then sends back the 404 page. Nginx doesn't itself look for any files in your filesystem because of this configuration.

1
  • Thanks a lot for suggest, after that i had observed lightpd on this server and add the host in /etc/lighttpd/lighttpd.conf and make host file in hosts folder! Sep 3, 2016 at 5:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .