Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx 404,failed (13: Permission denied) #3156

Closed
plum9696 opened this issue Feb 21, 2022 · 3 comments
Closed

nginx 404,failed (13: Permission denied) #3156

plum9696 opened this issue Feb 21, 2022 · 3 comments

Comments

@plum9696
Copy link

Description:

Sorry, my English is very poor, I can only use Google to translate the problem I encountered. It may be a bit confusing

  • I successfully deployed the environment according to the official website tutorial
  • Because of network problems, I modified the mirror address that China can access
  • When I accessed the domain name, 404 appeared, so I checked the error log of nginx
2022/02/21 22:49:09 [crit] 10#10: *3 stat() "/var/www/laravel-shop/public/index.php" failed (13: Permission denied), client: 111.111.111.1, server: laravel-shop.test, request: "GET /favicon.ico HTTP/1.1", host: "laravel-shop.test", referrer: "http://laravel-shop.test/"
  • After I found out that it was a permission error, I checked that nginx was started by www-data, all files on my website were root:root, and had 777 permissions, I don't know why this happened
  • I have a question, my file permission is 777, why other groups do not have permission to access

Expected Behavior:

Context information:

Output of git rev-parse HEAD

{paste here}

Output of docker version

{paste here}

Output of docker-compose version

{paste here}

System info: Mac, Windows or Linux. Include which disto/version

{paste here}

Steps to reproduce the issue:

Stacktrace & Additional info:

{paste here}
@plum9696
Copy link
Author

After I found the error, I modified the nginx configuration file
before modification

user  www-data;

after modification

user root;

The website does not appear 404, but it will appear File not found.
I checked the error log of nignx again

2022/02/21 23:31:51 [error] 11#11: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 111.111.111.1, server: laravel-shop.test, request: "GET / HTTP/1.1", upstream: "fastcgi://172.22.0.3:9000", host: "laravel-shop.test"

I searched the problem through search engine, but can't find a solution, can anyone help me?

@plum9696
Copy link
Author

If you find that your permissions are correct, but nginx still cannot access the website due to permission problems, then the reason for the error may be that you are using vmware, and you need to add -o allow_other when sharing file directories.

@geeksupport1
Copy link

I found this

https://lifesaver.codes/answer/error-404-page-not-found-86

change laradock/nginx/sites/default.conf
from:
root /var/www/public;
to
root /var/www;
=============

Same thing happened to me, I was going crazy with the 404...
Either - ../:/var/www becomes - ../:/var/www/public on docker-compoe.yml or the Nginx default site configurations needs to be updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants