我的discuz放在bbs二级目录中,一级目录放的是wordpress mu程序,我的nginx配置如下:
log_format vfcai.com '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
server
{
listen 80;
server_name vfcai.com *.vfcai.com;
index index.html index.htm index.php default.html default.htm default.php;
root /data/wwwroot/vfcai.com;
include wordpress.conf;
location ~ .*\.(php|php5)?$
{
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log /home/wwwlogs/vfcai.com.log vfcai.com;
}
server
{
server_name www.vfcai.com;
rewrite ^(.*) http://vfcai.com/ permanent;
}
server
{
server_name bbs.vfcai.com;
index index.htm index.html index.php;
root /data/wwwroot/vfcai.com/bbs/;
location ~ .*\.(php|php5)?$
{
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_NAME /bbs/$fastcgi_script_name;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
}
我通过bbs.vfcai.com访问我的网站的时候会出现index.php的下载,不能正常访问网站,请问下我的nginx配置哪里出错了?
你关于bbs.vfcai.com的配置完全不对啊,你都没有配置fastcgi,那么肯定是会下载文件了呀!
建议重新看nginx的配置方法,从基础学起不要抄网上配置. 访问bbs.vfcai.com,第一个server的第一个location配置策略将会响应,这无法达到你希望在第三个server配置的策略得到响应.