您好,欢迎访问一九零五行业门户网

PHPFastCGI在Nginx的alias下404的解决方案

在nginx的官方wiki中如下描述
the alias directive cannot be used inside a regex-specified location. if you need to do this you must use a combination of rewrite and root.
在实际使用中alias下面的php返回404,而html确可以正常显示,解决方法如下
location / {
root /opt/www/htdocs/www;
index index.php index.html index.htm;
}
location /bbs/ {
alias /opt/www/htdocs/bbs/;
index index.php index.html index.htm;
}
location ~ ^/bbs/.+.php{  
root /opt/www/htdocs;  
rewrite /bbs/(.*.php?) /1 break;
include conf/fcgi.conf;
fastcgi_pass 127.0.0.1:10080;
fastcgi_index index.php;
fastcgi_param script_filename /opt/www/htdocs/bbs$fastcgi_script_name;
}
即用root加rewrite替换alias
来源:http://blog.tcisv.cn/index.php/2009/06/phpfastcgi%e5%9c%a8nginx%e7%9a%84alias%e4%b8%8b404%e7%9a%84%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88/
').addclass('pre-numbering').hide(); $(this).addclass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadein(1700); }); }); 以上就介绍了phpfastcgi在nginx的alias下404的解决方案,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。
其它类似信息

推荐信息