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

Suggested nginx config not working on Ubuntu 16.04 + nginx 1.10 + PHP7.0 #181

Open
neopostmodern opened this issue Oct 17, 2016 · 12 comments
Labels

Comments

@neopostmodern
Copy link

I was getting a blank page and 200 for everything.

After adding the following line as suggested on StackOverflow somewhere I got it to work:

fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name

Not sure if this is necessary for all versions, but maybe add a hint?

@cdevroe
Copy link
Owner

cdevroe commented Oct 18, 2016

@neopostmodern Perhaps you can suggest an update for the Readme?

@neopostmodern
Copy link
Author

Will do. Maybe someone with proper nginx knowledge could comment if that could be added to the default config or if it's platform specific?

@moltenkaizen
Copy link

moltenkaizen commented Oct 19, 2016

Tested on Ubuntu 16.04 and saw the same behaviour you described (200OK with blank page)

Then I added your suggested line to the nginx config and unmark loaded right up
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;

I've also tested this line works as well:
fastcgi_param SCRIPT_FILENAME $request_filename;
http://serverfault.com/questions/502776/what-is-the-correct-setting-of-nginxs-fastcgi-param-script-filename

I'm also running unmark on Ubuntu 14.04 on nginx and the /etc/nginx/fastcgi_params file has:
fastcgi_param SCRIPT_FILENAME $request_filename;

I'm not an nginx expert by any means, but based on documentation on the nginx site of some examples, I propose the addition of the following line to the unmark nginx readme.
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

@neopostmodern
Copy link
Author

I also just recognized the following:

$ ls /etc/nginx | grep fastcgi
fastcgi.conf
fastcgi_params

and further

$ diff fastcgi_params fastcgi.conf 
1a2
> fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

...which basically says that there is another file (fastcgi.conf) that includes the required line.

Researching if this was safe to use, I found this blog entry:

In 0.8.30 (released: 15th of December 2009) Igor then included fastcgi.conf which was the same as fastcgi_params except including the improved SCRIPT_FILENAME fastcgi_param. This meant that the community could now start recommending people include fastcgi.conf instead of recommending moving SCRIPT_FILENAME into fastcgi_params. New articles on the wiki mostly used this, the popular articles were slowly changed to use it and we were promoting it in the IRC support channel.

Long story short, maybe it's a better fix to change the inclusion.

@moltenkaizen
Copy link

Very interesting, I see that's the only difference between those files. I see what you mean on my Ubuntu 16 as well.

I'm also comparing that to Ubuntu 14.04, I don't have a fastcgi.conf. But their fastcgi_params already had the line
fastcgi_param SCRIPT_FILENAME $request_filename;
which seems to work like
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name

Changing the include on Ubuntu 16 makes sense. Maybe a few notes could be added to the readme to give tips on working basic nginx configs for a few common distros.
This fixes Ubuntu 16 but would break 14.
include /etc/nginx/fastcgi.conf;

@neopostmodern
Copy link
Author

neopostmodern commented Oct 19, 2016

Wow, I had included that blog post because 2009 sounded like it would have landed everywhere, but... well.

Proposal, to be included right below the sample code:

The content of /etc/nginx/fastcgi_params appeares to be distro dependent. Make sure yours includes a fastcgi_param SCRIPT_FILENAME line (e.g. by running cat /etc/nginx/fastcgi_params | grep SCRIPT_FILENAME).
Should you be missing this line you can try to replace include /etc/nginx/fastcgi_params; with include /etc/nginx/fastcgi.conf;, in case your distro ships it. Otherwise, please add fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; to your nginx configuration.
For further discussion refer to #181.

@moltenkaizen
Copy link

@neopostmodern Looks great to me. I'd make a very minor tweak

grep SCRIPT_FILENAME /etc/nginx/fastcgi_params
Just a touch more concise

@cdevroe thoughts?

@weaktyper
Copy link

@neopostmodern
did you get this working in the end?

@neopostmodern
Copy link
Author

neopostmodern commented Dec 14, 2016

Doing this enabled me to access the site, but this SQL issue remains and I'm reluctant to change all the modes, so I haven't been able to use it on my machine.

This issue was really all about changing the documentation.

@mclang
Copy link

mclang commented Dec 15, 2016

Changing include /etc/nginx/fastcgi_params; to include /etc/nginx/fastcgi.conf; worked for me.

Has anybody make pull request about the fix already?

1 similar comment
@mclang
Copy link

mclang commented Dec 16, 2016

Changing include /etc/nginx/fastcgi_params; to include /etc/nginx/fastcgi.conf; worked for me.

Has anybody make pull request about the fix already?

@mclang
Copy link

mclang commented Dec 16, 2016

I made some changes according to new Nginx documentation.

I hope I got it right!

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

No branches or pull requests

5 participants