Unable to find cause of 403 Forbidden error: Nginx Daphne DjangoWhere can I find the error logs of nginx, using fastcgi and djangoNginx 403 forbidden for all filesNginx Webhook Allow IP Djangonginx 403 forbidden under Debian 7force_ssl on a Rails 4 app with nginx + unicorn gives a 503 (Service Temporarily Unavailable) errorExpress - req.ip returns 127.0.0.1Wordpress constant redirect with nginx upstreamKeycloak Redirect url with nginx is going to http rather than httpsnginx docker compose redirect delayCannot get index.php page to display in docker container

Do all network devices need to make routing decisions, regardless of communication across networks or within a network?

Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?

Is `x >> pure y` equivalent to `liftM (const y) x`

Did Dumbledore lie to Harry about how long he had James Potter's invisibility cloak when he was examining it? If so, why?

Integer addition + constant, is it a group?

Is the destination of a commercial flight important for the pilot?

How do we know the LHC results are robust?

How does it work when somebody invests in my business?

Is there a problem with hiding "forgot password" until it's needed?

Customer Requests (Sometimes) Drive Me Bonkers!

Do the temporary hit points from the Battlerager barbarian's Reckless Abandon stack if I make multiple attacks on my turn?

Roman Numeral Treatment of Suspensions

What happens if you roll doubles 3 times then land on "Go to jail?"

Is expanding the research of a group into machine learning as a PhD student risky?

Detecting if an element is found inside a container

Risk of infection at the gym?

How easy is it to start Magic from scratch?

A particular customize with green line and letters for subfloat

How to be diplomatic in refusing to write code that breaches the privacy of our users

For a non-Jew, is there a punishment for not observing the 7 Noahide Laws?

How does Loki do this?

Term for the "extreme-extension" version of a straw man fallacy?

You cannot touch me, but I can touch you, who am I?

Why escape if the_content isnt?



Unable to find cause of 403 Forbidden error: Nginx Daphne Django


Where can I find the error logs of nginx, using fastcgi and djangoNginx 403 forbidden for all filesNginx Webhook Allow IP Djangonginx 403 forbidden under Debian 7force_ssl on a Rails 4 app with nginx + unicorn gives a 503 (Service Temporarily Unavailable) errorExpress - req.ip returns 127.0.0.1Wordpress constant redirect with nginx upstreamKeycloak Redirect url with nginx is going to http rather than httpsnginx docker compose redirect delayCannot get index.php page to display in docker container













0















I have had confirmation in another question that I can indeed run a Django app using only Nginx and Daphne and have modified my nginx config code as per their suggestion.



The application is running with Daphne on 127.0.0.1:8001



However, I am running into a 403 Forbidden error. The nginx error logs say:



"2019/03/07 11:23:48 [error] 16642#16642: *11 directory index of "/path/to/app" is forbidden, client: xx.xxx.xx.xx, server: app.com, request: "GET / HTTP/1.1", host: "www.app.com", referrer: "http://www.app.com""


I'm still facing a 403 and would be grateful to anyone who may be able to locate where the problem is coming from.



My nginx config



upstream socket 
ip_hash;
server 127.0.0.1:8001 fail_timeout=0;


server

listen 80;
#listen [::]:80 ipv6only=on;

server_name your.server.com;
access_log /etc/nginx/access.log;

root /var/www/html/someroot;

location /
#autoindex on;

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

#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header Host $http_host;
#proxy_set_header X-NginX-Proxy true;
#proxy_pass http://socket;
#proxy_redirect off;
#proxy_http_version 1.1;
#proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection "upgrade";

#proxy_redirect off;
#proxy_set_header X-Forwarded-Proto $scheme;
#proxy_cache one;
#proxy_cache_key sfs$request_uri$scheme;


listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/some/fullchain.pem;
# managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/some/privkey.pem;
# managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot

if ($scheme != "https")
return 301 https://$host$request_uri;











share|improve this question

















  • 1





    autoindex by default is off, that's why attempt to browse a "directory" raises 403. This error is returned by nginx because proxy_pass to django app is disabled.

    – Ivan Starostin
    Mar 7 at 13:09











  • How do I enable proxy_pass to a django app?

    – Trilla
    Mar 7 at 13:13






  • 1





    Try to uncomment it.

    – Ivan Starostin
    Mar 7 at 13:21











  • Ha ha wow it's been a long day

    – Trilla
    Mar 7 at 13:35











  • I now get a 404 Not Found, when I uncomment that block, which I assume is because it can't serve it as a file or directory.

    – Trilla
    Mar 7 at 13:49















0















I have had confirmation in another question that I can indeed run a Django app using only Nginx and Daphne and have modified my nginx config code as per their suggestion.



The application is running with Daphne on 127.0.0.1:8001



However, I am running into a 403 Forbidden error. The nginx error logs say:



"2019/03/07 11:23:48 [error] 16642#16642: *11 directory index of "/path/to/app" is forbidden, client: xx.xxx.xx.xx, server: app.com, request: "GET / HTTP/1.1", host: "www.app.com", referrer: "http://www.app.com""


I'm still facing a 403 and would be grateful to anyone who may be able to locate where the problem is coming from.



My nginx config



upstream socket 
ip_hash;
server 127.0.0.1:8001 fail_timeout=0;


server

listen 80;
#listen [::]:80 ipv6only=on;

server_name your.server.com;
access_log /etc/nginx/access.log;

root /var/www/html/someroot;

location /
#autoindex on;

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

#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header Host $http_host;
#proxy_set_header X-NginX-Proxy true;
#proxy_pass http://socket;
#proxy_redirect off;
#proxy_http_version 1.1;
#proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection "upgrade";

#proxy_redirect off;
#proxy_set_header X-Forwarded-Proto $scheme;
#proxy_cache one;
#proxy_cache_key sfs$request_uri$scheme;


listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/some/fullchain.pem;
# managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/some/privkey.pem;
# managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot

if ($scheme != "https")
return 301 https://$host$request_uri;











share|improve this question

















  • 1





    autoindex by default is off, that's why attempt to browse a "directory" raises 403. This error is returned by nginx because proxy_pass to django app is disabled.

    – Ivan Starostin
    Mar 7 at 13:09











  • How do I enable proxy_pass to a django app?

    – Trilla
    Mar 7 at 13:13






  • 1





    Try to uncomment it.

    – Ivan Starostin
    Mar 7 at 13:21











  • Ha ha wow it's been a long day

    – Trilla
    Mar 7 at 13:35











  • I now get a 404 Not Found, when I uncomment that block, which I assume is because it can't serve it as a file or directory.

    – Trilla
    Mar 7 at 13:49













0












0








0








I have had confirmation in another question that I can indeed run a Django app using only Nginx and Daphne and have modified my nginx config code as per their suggestion.



The application is running with Daphne on 127.0.0.1:8001



However, I am running into a 403 Forbidden error. The nginx error logs say:



"2019/03/07 11:23:48 [error] 16642#16642: *11 directory index of "/path/to/app" is forbidden, client: xx.xxx.xx.xx, server: app.com, request: "GET / HTTP/1.1", host: "www.app.com", referrer: "http://www.app.com""


I'm still facing a 403 and would be grateful to anyone who may be able to locate where the problem is coming from.



My nginx config



upstream socket 
ip_hash;
server 127.0.0.1:8001 fail_timeout=0;


server

listen 80;
#listen [::]:80 ipv6only=on;

server_name your.server.com;
access_log /etc/nginx/access.log;

root /var/www/html/someroot;

location /
#autoindex on;

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

#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header Host $http_host;
#proxy_set_header X-NginX-Proxy true;
#proxy_pass http://socket;
#proxy_redirect off;
#proxy_http_version 1.1;
#proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection "upgrade";

#proxy_redirect off;
#proxy_set_header X-Forwarded-Proto $scheme;
#proxy_cache one;
#proxy_cache_key sfs$request_uri$scheme;


listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/some/fullchain.pem;
# managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/some/privkey.pem;
# managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot

if ($scheme != "https")
return 301 https://$host$request_uri;











share|improve this question














I have had confirmation in another question that I can indeed run a Django app using only Nginx and Daphne and have modified my nginx config code as per their suggestion.



The application is running with Daphne on 127.0.0.1:8001



However, I am running into a 403 Forbidden error. The nginx error logs say:



"2019/03/07 11:23:48 [error] 16642#16642: *11 directory index of "/path/to/app" is forbidden, client: xx.xxx.xx.xx, server: app.com, request: "GET / HTTP/1.1", host: "www.app.com", referrer: "http://www.app.com""


I'm still facing a 403 and would be grateful to anyone who may be able to locate where the problem is coming from.



My nginx config



upstream socket 
ip_hash;
server 127.0.0.1:8001 fail_timeout=0;


server

listen 80;
#listen [::]:80 ipv6only=on;

server_name your.server.com;
access_log /etc/nginx/access.log;

root /var/www/html/someroot;

location /
#autoindex on;

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

#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header Host $http_host;
#proxy_set_header X-NginX-Proxy true;
#proxy_pass http://socket;
#proxy_redirect off;
#proxy_http_version 1.1;
#proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection "upgrade";

#proxy_redirect off;
#proxy_set_header X-Forwarded-Proto $scheme;
#proxy_cache one;
#proxy_cache_key sfs$request_uri$scheme;


listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/some/fullchain.pem;
# managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/some/privkey.pem;
# managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot

if ($scheme != "https")
return 301 https://$host$request_uri;








django nginx django-channels daphne






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 12:58









TrillaTrilla

979




979







  • 1





    autoindex by default is off, that's why attempt to browse a "directory" raises 403. This error is returned by nginx because proxy_pass to django app is disabled.

    – Ivan Starostin
    Mar 7 at 13:09











  • How do I enable proxy_pass to a django app?

    – Trilla
    Mar 7 at 13:13






  • 1





    Try to uncomment it.

    – Ivan Starostin
    Mar 7 at 13:21











  • Ha ha wow it's been a long day

    – Trilla
    Mar 7 at 13:35











  • I now get a 404 Not Found, when I uncomment that block, which I assume is because it can't serve it as a file or directory.

    – Trilla
    Mar 7 at 13:49












  • 1





    autoindex by default is off, that's why attempt to browse a "directory" raises 403. This error is returned by nginx because proxy_pass to django app is disabled.

    – Ivan Starostin
    Mar 7 at 13:09











  • How do I enable proxy_pass to a django app?

    – Trilla
    Mar 7 at 13:13






  • 1





    Try to uncomment it.

    – Ivan Starostin
    Mar 7 at 13:21











  • Ha ha wow it's been a long day

    – Trilla
    Mar 7 at 13:35











  • I now get a 404 Not Found, when I uncomment that block, which I assume is because it can't serve it as a file or directory.

    – Trilla
    Mar 7 at 13:49







1




1





autoindex by default is off, that's why attempt to browse a "directory" raises 403. This error is returned by nginx because proxy_pass to django app is disabled.

– Ivan Starostin
Mar 7 at 13:09





autoindex by default is off, that's why attempt to browse a "directory" raises 403. This error is returned by nginx because proxy_pass to django app is disabled.

– Ivan Starostin
Mar 7 at 13:09













How do I enable proxy_pass to a django app?

– Trilla
Mar 7 at 13:13





How do I enable proxy_pass to a django app?

– Trilla
Mar 7 at 13:13




1




1





Try to uncomment it.

– Ivan Starostin
Mar 7 at 13:21





Try to uncomment it.

– Ivan Starostin
Mar 7 at 13:21













Ha ha wow it's been a long day

– Trilla
Mar 7 at 13:35





Ha ha wow it's been a long day

– Trilla
Mar 7 at 13:35













I now get a 404 Not Found, when I uncomment that block, which I assume is because it can't serve it as a file or directory.

– Trilla
Mar 7 at 13:49





I now get a 404 Not Found, when I uncomment that block, which I assume is because it can't serve it as a file or directory.

– Trilla
Mar 7 at 13:49












1 Answer
1






active

oldest

votes


















0














I had to change try_files $uri=404; to try_files $uri $uri/ =404; and that fixed the issue of the main page however other pages still display 404 error.






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55044387%2funable-to-find-cause-of-403-forbidden-error-nginx-daphne-django%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I had to change try_files $uri=404; to try_files $uri $uri/ =404; and that fixed the issue of the main page however other pages still display 404 error.






    share|improve this answer



























      0














      I had to change try_files $uri=404; to try_files $uri $uri/ =404; and that fixed the issue of the main page however other pages still display 404 error.






      share|improve this answer

























        0












        0








        0







        I had to change try_files $uri=404; to try_files $uri $uri/ =404; and that fixed the issue of the main page however other pages still display 404 error.






        share|improve this answer













        I had to change try_files $uri=404; to try_files $uri $uri/ =404; and that fixed the issue of the main page however other pages still display 404 error.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 7 at 13:57









        TrillaTrilla

        979




        979





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55044387%2funable-to-find-cause-of-403-forbidden-error-nginx-daphne-django%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            1928 у кіно

            Захаров Федір Захарович

            Ель Греко