-
-
Notifications
You must be signed in to change notification settings - Fork 248
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
[BUG] files that do not exists downloads index.php #420
Comments
If you remove header("HTTP/1.0 404 Not Found"); from your echo "Hello World"; with the original nginx configuration shipped, does that work as expected? The reason for the |
If I replace it with the hello world example, the browser downloads <?php
echo "Hello World"; |
I have confirmed the behavior and done some searching as to the reason behind it but not found a concrete answer yet. I'll keep searching later. I am unsure about making the exact change you mentioned (removing If you can dig up any documentation on why nginx/php behave this way with this configuration feel free to cite it here and I'll see what we can do to adjust. |
Like I mentioned, I'm not an expert in nginx, but I'm happy to do a bit of investigation as well |
This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions. |
Leaving a note for myself to continue investigating: try_files $fastcgi_script_name =404; inside the php location and removing |
After a bit of testing this seems to be a working fix. @golles if you'd like to test the changes you can see a fully updated copy of the default.conf here https://github.com/linuxserver/docker-swag/blob/fbe212b67c8dd255e326daa30fd4517fed0523e4/root/defaults/nginx/site-confs/default.conf.sample and specifically the lines changed are easy to see in this PR #432 |
This looks good, awesome! None php files give an empty body, with the PHP extension I get: <html>
<head>
<title>404 Not Found</title>
</head>
<body>
<center>
<h1>404 Not Found</h1>
</center>
<hr>
<center>nginx</center>
</body>
</html> But I guess that is expected as the request is handled by PHP in such a case. |
Is there an existing issue for this?
Current Behavior
I'm not an expert in Nginx, so I hope I've provided enough information.
When I open the following URLs in a browser, this is what happens:
https://domain.tld/foo -> downloads foo (content is index.php)
https://domain.tld/foo.html -> downloads foo (content is index.php)
https://domain.tld/foo.php -> serves index.php
My
index.php
looks like this:I do not have an
index.html
file.Expected Behavior
My assumption is that all the above examples would serve
index.php
.I think the problem is with this line,
https://github.com/linuxserver/docker-swag/blob/master/root/defaults/nginx/site-confs/default.conf.sample#L51
When I change it to
Things happen as I expect.
Steps To Reproduce
I'm using the default config as provided here: https://github.com/linuxserver/docker-swag/blob/master/root/defaults/nginx/site-confs/default.conf.sample
See my steps in the current behavior above.
Environment
CPU architecture
x86-64
Docker creation
Container logs
The text was updated successfully, but these errors were encountered: