在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?) /;
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
').text(i)); }; $numbering.fadeIn(1700); }); });
以上就介紹了PHPFastCGI在Nginx的alias下404的解決方案,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。