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

  • This doesn't look like an nginx error page. Check your web application. – Michael Hampton Sep 2 '16 at 17:50
  • Michael, thank you! My index.html in htdocs at this moment contains only "Hello World" with !DOCTYPE, html and body. – Vadim Shvetsov Sep 2 '16 at 19:02
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.

| improve this answer | |
  • 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! – Vadim Shvetsov Sep 3 '16 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.