我的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配置哪裡出錯了?
PHPz2017-05-16 17:30:48
建議重新看nginx的配置方法,從基礎學起不要抄網上配置. 訪問bbs.vfcai.com,第一個server的第一個location配置策略將會回應,這無法達到你希望在第三個server配置的策略得到回應.