PHP and CGI on UserDir
Francis Daly
francis at daoine.org
Tue Dec 1 20:50:05 UTC 2015
On Wed, Dec 02, 2015 at 01:52:06AM +0900, Smart Goldman wrote:
> 2015-11-29 20:10 GMT+09:00 Francis Daly <francis at daoine.org>:
> > On Sun, Nov 29, 2015 at 05:04:50PM +0900, Smart Goldman wrote:
Hi there,
> location ~ ^/~(.+?)(/.*)?\.(php)$ {
> alias /home/$1/public_html$2.$3;
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_index index.php;
Delete that line - it does nothing useful here. (It does no harm, other
than being a distraction.)
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
Change that line to be just
fastcgi_param SCRIPT_FILENAME $document_root;
"alias" is a bit funny. In this context, it means that $document_root
corresponds to the file on the filesystem that you want the fastcgi
server to process.
I'm a bit surprised that the current version works -- perhaps your php
config does not have
cgi.fix_pathinfo=0
and so takes more than one guess at the file to process.
> include /etc/nginx/fastcgi_params;
> }
>
> location ~ ^/~(.+?)(/.*)?\.(pl|cgi)$ {
> alias /home/$1/public_html$2.$3;
> fastcgi_pass 127.0.0.1:8999;
> fastcgi_index index.cgi;
Delete.
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
Change to remove $fastcgi_script_name, just like the previous case.
Here, most likely php is not involved, and your fastcgi server just tries
to process SCRIPT_FILENAME, which does not name a real file right now.
> include /etc/nginx/fastcgi_params;
> }
> After that, I restarted nginx. Looks like PHP (/~user/index.php) finally
> works!
> But CGI (/~user/index.cgi) says "Error: No such CGI app -
> /home/user/public_html/index.cgi/~user/index.cgi may not exist or is not
> executable by this process." though I don't know why.
I think that the explanations are above, along with the one necessary fix
(for cgi/pl) and the one strongly suggested fix (for php).
Good luck with it,
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list