}
location ~ .php$ {
root /web/sohu;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
最后在客户端测试虚拟主机www.baidu.com和www.sina.com两家公司网站
21.列表页显示
location / {
autoindex on; #打开列表页
root html;
index index.html index.php index.htm;
}
22.虚拟目录设置
location /bbs{
alias /mnt/bbs/;
}
#这样配置html静态文件是可以出来的,但是php动态页面出不来,而且会浏览器的页面上会显示" No input file specified. "的报错,其实是php系统文件地址( SCRIPT_FILENAME)找不到,也就是说fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;中的$document_root$fastcgi_script_name不是真正的/mnt/bbs/index.php的地址,这可怎么解决:
location /bbs {
alias /mnt/bbs/;
index bbs.php index.html index.php;
}
location ~ ^/bbs/ {
root /mnt/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
log_format bbs '$document_root$fastcgi_script_name ';








