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

            Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

            Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

            Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved