/data/www$fastcgi_script_name;
include fastcgi_params;
}
In /data/www, I have a “pi” directory, containing:
–($ /opt/coolstack/nginx/conf)-- ls -l /data/www/pi
total 1
-rw-r–r-- 1 webservd webservd 26 Nov 4 13:49 index.php
–($ /opt/coolstack/nginx/conf)-- cat /data/www/pi/index.php
<?php
phpinfo();
# EOF #
When I now call http://$server/pi/, I'm shown the directory
index of the "pi" directory (because I have "autoindex on;").
What would be the proper way to have nginx "show" the
index.php, if there's one and if http://$server/$dir/ is
invoked? (I don't want to see the source code of index.php,
I want to have that interpreted by PHP.)
Do I have to add it to the "index" direcetive, like so?
location / {
root /data/www;
index default.htm index.html index.htm index.php;
}
This works, but is that the way it's supposed to be done?
But also adding "fastcgi_index index.php;" to the
"location / { … }" statement doesn't make nginx call
PHP with the index.php.
Hm.
I don't think that I understand what fastcgi_index
should be doing.
I now changed the nginx.conf to contain:
http {
# …
server {
# …
location / {
root /data/www;
index default.htm index.html index.htm index.php;
}
location ~ \.php$ {
root /data/www;
fastcgi_pass 127.0.0.1:65505;
fastcgi_index SCHNISMindex.php;
fastcgi_param SCRIPT_FILENAME
/data/www$fastcgi_script_name;
include fastcgi_params;
}
}
}
Effect: When http://$srv/$dir/ is invoked by the browser,
whatever is in index.php is feed to PHP and shown to
the browser.
Nice — But why is that so? I would have thought, that because
of the (in this case purposely) mis-configured fastcgi_index
parameter, it shouldn't have worked. I would have
thought, that a "SCHNISMindex.php" would have been
passed to PHP. Why is that not so?
What does fastcgi_index do? I have read (and obviously not
understood)
http://wiki.codemongers.com/NginxHttpFcgiModule#fastcgi_index
of course :)
Thanks a lot,
Mchael
--
--
GMX Download-Spiele: Preizsturz! Alle Puzzle-Spiele Deluxe über 60%
billiger.
http://games.entertainment.gmx.net/de/entertainment/games/download/puzzle/index.html
On Thu, Nov 06, 2008 at 09:51:42AM +0100, Michael S. wrote:
include fastcgi_params;
Do I have to add it to the “index” direcetive, like so?
PHP with the index.php.
server {
fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
of the (in this case purposely) mis-configured fastcgi_index
parameter, it shouldn’t have worked. I would have
thought, that a “SCHNISMindex.php” would have been
passed to PHP. Why is that not so?
the index sees /data/www/index.php and does internal redirect to
/index.php,
so the request goes to “location ~ .php$” and is passed to fastcgi.
However, if fastcgi server is remote one, and nginx has no access to its
filesystem, then index has no idea about remote index files. The
fastcgi_index
should help here: it simply adds its value to any /dir/, i.e. it maps
/dir/ to /dir/index.php.
Let me see, if I got this right - fastcgi_index is, in my setup,
where nginx and the fastcgi server share filesystems, in such
a setup fastcgi_index doesn’t do anything at all and can be
omitted.
On Thu, Nov 06, 2008 at 12:32:03PM +0100, Michael S. wrote:
}
should help here: it simply adds its value to any /dir/, i.e. it maps
omitted.
Correct?
Yes, fastcgi_index inside “location ~ .php$” does not anything because
he location matches .php only files, but not “…/” requests.
Also, note that “index” can test several index files (PHP, HTML, etc) on
local filesystem, but “fastcgi_index” can add the single index file only
in $fastcgi_script_name variable to pass it to fastcgi server.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.