unmark
unmark copied to clipboard
Suggested nginx config not working on Ubuntu 16.04 + nginx 1.10 + PHP7.0
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?
@neopostmodern Perhaps you can suggest an update for the Readme?
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?
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;
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.
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;
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 afastcgi_param SCRIPT_FILENAME
line (e.g. by runningcat /etc/nginx/fastcgi_params | grep SCRIPT_FILENAME
). Should you be missing this line you can try to replaceinclude /etc/nginx/fastcgi_params;
withinclude /etc/nginx/fastcgi.conf;
, in case your distro ships it. Otherwise, please addfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
to your nginx configuration. For further discussion refer to #181.
@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?
@neopostmodern did you get this working in the end?
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.
Changing include /etc/nginx/fastcgi_params;
to include /etc/nginx/fastcgi.conf;
worked for me.
Has anybody make pull request about the fix already?
Changing include /etc/nginx/fastcgi_params;
to include /etc/nginx/fastcgi.conf;
worked for me.
Has anybody make pull request about the fix already?
I made some changes according to new Nginx documentation.
I hope I got it right!