Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am wondering if you can have more than one 'fastcgi_index' in nginx virtual config file... If you view my virtual.conf below you will see I put home.php next to 'index.php' My home.php is more or less my sites index.php. My site is running ok (if it was running better I wouldn't be looking to see if any tweaks can be made) with index.php as the 'fastcgi_index' but I am not even sure why index.php was used (other than it is most likely the default setting for 'fastcgi_index') since my site uses home.php rather than index.php. So my question is... will my site run better if I replace my current 'fastcgi_index' (index.php) to home.php. Or can I put both in 'fastcgi_index' as noted below?

location ~ \.php$ {
    root           /home/xx/usr/share/nginx/html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php **home.php;**
    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    include        fastcgi_params;
    include        fastcgi.conf;
share|improve this question

1 Answer 1

up vote 3 down vote accepted

No, fastcgi_index can only take a single filename. This is because nginx doesn't search for the specified filename, it simply appends the string which you provide to the URL if it ends with a slash and hands it off to the FastCGI service. FastCGI paths don't have to exist as files on the filesystem, and so nginx cannot verify their existence.

share|improve this answer
    
thanks, so do you recommend I use index.php or home.php? –  Andrew Jun 25 '12 at 23:26
    
@Andrew index.php is more common, but it doesn't really matter. If you already use home.php then just go with that. –  mgorven Jun 25 '12 at 23:28
1  
It doesn't actually matter which one you use. Because of the location match, the url is already guaranteed to end with ".php" so fastcgi_index won't ever come into play. –  kolbyjack Jun 26 '12 at 0:09
    
@mgorven thank you, I really appreciate it. –  Andrew Jun 26 '12 at 1:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.