nginx設定discuz二級網域的問題
PHP中文网
PHP中文网 2017-05-16 17:28:48
0
2
733

我的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配置哪裡出錯了?

PHP中文网
PHP中文网

认证0级讲师

全部回覆(2)
大家讲道理

你關於bbs.vfcai.com的設定完全不對啊,你都沒有配置fastcgi,那麼肯定是會下載檔案了呀!

PHPzhong

建議重新看nginx的配置方法,從基礎學起不要抄網上配置. 訪問bbs.vfcai.com,第一個server的第一個location配置策略將會回應,這無法達到你希望在第三個server配置的策略得到回應.

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!