码迷,mamicode.com
首页 > 其他好文 > 详细

Nginx 配置中 fastcgi_index 起什么作用?

时间:2015-06-02 00:31:37      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:

1,fastcgi_index 语法:fastcgi_index file
默认值:none
使用字段:http, server, location
如果URI以斜线结尾,文件名将追加到URI后面,这个值将存储在变量$fastcgi_script_name中。例如:
fastcgi_index  index.php;
fastcgi_param  SCRIPT_FILENAME  /home/www/scripts/php$fastcgi_script_name;
请求"/page.php",参数SCRIPT_FILENAME将被设置为"/home/www/scripts/php/page.php",但是请求"/"则为"/home/www/scripts/php/index.php"。

2,
fastcgi_index:如果请求的FastCGI URI以/结束,该指令设置的文件会被附加到URI的后面并保存在变量$fastcgi_script_name中
index:该指令用于设置nginx的默认首页文件


而我们的配置经常是
location ~* \.php$ {
    fastcgi_pass    cos_ups;
    fastcgi_index   index.php;
    include             fastcgi.conf;
}
在这里指定fastcgi_index  其实是没有用的,因为前面的location ~* \.php$已经把“/结束”这种情况排除了


Nginx 配置中 fastcgi_index 起什么作用?

标签:

原文地址:http://blog.csdn.net/pcyph/article/details/46317373

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!