nginx 中的动态虚拟主机给我空白页

nginx 中的动态虚拟主机给我空白页

我正在尝试为 nginx 创建配置,其中任何子域都链接到文件夹子域中的本地文件夹。例如,当我输入 test.example.com 时,它会跟随到 /var/www/html/example.com/public_html/subdomains/test/。

我按照此链接创建配置https://www.sitepoint.com/set-automatic-virtual-hosts-nginx-apache/对于虚拟主机

`

    include common/upstream;

    server
    {
            listen 80;
            root    /var/www/html/example.com/public_html;
            index   index.php index.html index.htm;
            server_name example.com;

            error_log "/var/www/html/example.com/logs/error.log";
            access_log "/var/www/html/example.com/logs/access.log";

            client_max_body_size        5m;

            # Buffers
            fastcgi_buffers 64 4K;

            # Security
            include common/security;

            # Gzip
            include common/gzip;

            # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
            location ~ \.php$ {
                    include common/php-fpm;
            }

            # Deny
            include common/deny;
    }

    # 301 redirect from www
    server {
            server_name www.example.com;
            return 301 $scheme://example.com$request_uri;
    }

    # subdomain for static content
    server {
            listen 80;
            server_name st.example.com;
            root /var/www/html/example.com/public_html;

            # Deny
            include common/deny;

            # Cache
            include common/cache;

            fastcgi_hide_header Set-Cookie;
    }

    # dynamic subdomains
    server {
            listen 80;
            server_name ~^(?<sname>.+?)\.example\.com$;

            root /var/www/html/example.com/public_html/subdomains/$sname;

            index   index.php index.html index.htm;

            # Security
            include common/security;

            # Gzip
            include common/gzip;

            location ~ \.php$ {
                    root /var/www/html/example.com/public_html/subdomains/$1;
                    include common/php-fpm;
            }
    }

`

但页面总是空白。当我使用

curl -I example.com

我得到 200,但页面是空的。访问日志包含数据,但错误日志是空的。

UPD。当我访问http://test.example.com/index.php我的日志包含

    46.188.125.20 - - [20/Feb/2017:04:00:36 +0300] "GET / HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36"
    46.188.125.20 - - [20/Feb/2017:04:00:39 +0300] "GET /index.php HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36"

UPD2

    cat /var/log/php5-fpm.log
    [19-Feb-2017 04:34:14] NOTICE: error log file re-opened
    [19-Feb-2017 05:52:32] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [19-Feb-2017 06:39:59] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [19-Feb-2017 06:55:30] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [19-Feb-2017 07:05:49] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [19-Feb-2017 07:25:54] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [19-Feb-2017 07:46:33] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [19-Feb-2017 07:53:12] WARNING: [pool www] child 11518 exited on signal 9 (SIGKILL) after 728.762471 seconds from start
    [19-Feb-2017 07:53:12] NOTICE: [pool www] child 11713 started
    [19-Feb-2017 08:07:00] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [19-Feb-2017 08:33:49] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [19-Feb-2017 10:12:52] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [19-Feb-2017 15:01:44] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [19-Feb-2017 21:01:13] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [19-Feb-2017 21:11:40] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [19-Feb-2017 21:15:27] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [19-Feb-2017 21:37:47] WARNING: [pool www] child 30209 exited with code 70 after 273.254342 seconds from start
    [19-Feb-2017 21:37:47] NOTICE: [pool www] child 30320 started
    [19-Feb-2017 22:08:14] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [20-Feb-2017 00:47:21] WARNING: [pool www] child 32444 exited with code 70 after 7285.548191 seconds from start
    [20-Feb-2017 00:47:21] NOTICE: [pool www] child 2367 started
    [20-Feb-2017 00:48:09] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [20-Feb-2017 00:57:06] WARNING: [pool www] child 2367 exited with code 70 after 585.167064 seconds from start
    [20-Feb-2017 00:57:06] NOTICE: [pool www] child 2599 started
    [20-Feb-2017 00:58:14] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [20-Feb-2017 01:08:54] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [20-Feb-2017 01:33:46] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [20-Feb-2017 01:53:59] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
    [20-Feb-2017 02:04:19] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it

相关内容