vBulletin 上行至 Nginx 服务器

vBulletin 上行至 Nginx 服务器

我在 RHC Openshift 上有两个帐户,所以我想在一个服务器上安装 nginx,在另一台服务器上安装 vbulletin,因此将服务器 1 与服务器 2 合并(nginx 到 Vbulletine)我尝试对 nginx 进行以下配置:

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
error_log /var/lib/openshift/568adf5a0c1e66dac3000283/app-root/logs/nginx_error.log debug;

pid        /var/lib/openshift/568adf5a0c1e66dac3000283/app-root/runtime/srv/nginx/logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;
    #access_log $OPENSHIFT_DIY_LOG_DIR/access.log main;
    port_in_redirect off;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  165;

    gzip  on;

    upstream frontends {
        #server pr4ss.tk;
        #server 222.66.115.233:80 weight=1;
        #server 127.6.145.1:8081 ;
        server vb2-fishsmarkets.rhcloud.com;

    }
    upstream frontends2 {
        server vb2-fishsmarkets.rhcloud.com;
        #server 222.66.115.233:80 weight=1;
        #server 127.6.145.1:8081 ;

    }
    upstream index {
        #server  community.elasa.ir;
        server vb2-fishsmarkets.rhcloud.com;
        #server 127.6.145.1:15001 weight=1;
        #server 127.6.145.1:15002 weight=2;
        #server 127.6.145.1:15002 weight=3;

    }

    server {
        listen      127.6.145.1:8080;
        server_name  diy-elasa2.rhcloud.com www.diy-elasa2.rhcloud.com;
        root /var/lib/openshift/568adf5a0c1e66dac3000283/app-root/runtime/repo/www;


        set_real_ip_from 127.6.145.1;
        real_ip_header X-Forwarded-For;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /var/lib/openshift/568adf5a0c1e66dac3000283/app-root/runtime/repo/www;
            index  index.html index.htm;
            try_files $uri $uri/ =404;

            autoindex on;
            autoindex_exact_size off;
            autoindex_localtime on;

            #proxy_set_header Authorization base64_encoding_of_"user:password";
            #proxy_pass_header Server;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_set_header  X-Real-IP  $remote_addr;
            proxy_set_header X-Scheme $scheme;
            proxy_pass http://frontends;

        }
        location /forum\.php {
                if (!-f $request_filename) {
                        rewrite ^/(.*)$ /index.php?routestring=$1 last;
                }
                autoindex on;
            autoindex_exact_size off;
            autoindex_localtime on;

            #proxy_set_header Authorization base64_encoding_of_"user:password";
            #proxy_pass_header Server;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_set_header  X-Real-IP  $remote_addr;
            proxy_set_header X-Scheme $scheme;
            proxy_pass http://frontends;
        }
        location /forum2 {
            #root   /var/lib/openshift/568adf5a0c1e66dac3000283/app-root/runtime/repo/www;
            index  index.html index.htm;

            autoindex on;
            autoindex_exact_size off;
            autoindex_localtime on;

            #proxy_set_header Authorization base64_encoding_of_"user:password";
            #proxy_pass_header Server;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_set_header  X-Real-IP  $remote_addr;
            proxy_set_header X-Scheme $scheme;
            proxy_pass http://frontends;
        }
        location /categories {
            #root   /var/lib/openshift/568adf5a0c1e66dac3000283/app-root/runtime/repo/www;
            index  index.html index.htm;

            autoindex on;
            autoindex_exact_size off;
            autoindex_localtime on;

            #proxy_set_header Authorization base64_encoding_of_"user:password";
            #proxy_pass_header Server;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_set_header  X-Real-IP  $remote_addr;
            proxy_set_header X-Scheme $scheme;
            proxy_pass http://frontends2;
        }
        location /index {
            #root   /var/lib/openshift/568adf5a0c1e66dac3000283/app-root/runtime/repo/www;
            index  index.html index.htm;

            autoindex on;
            autoindex_exact_size off;
            autoindex_localtime on;
            # an HTTP header important enough to have its own Wikipedia entry:
            #   http://en.wikipedia.org/wiki/X-Forwarded-For
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;


            # enable this if you forward HTTPS traffic to unicorn,
            # this helps Rack set the proper URL scheme for doing redirects:
            # proxy_set_header X-Forwarded-Proto $scheme;

            # pass the Host: header from the client right along so redirects
            # can be set properly within the Rack application
            proxy_set_header Host $http_host;

            # we don't want nginx trying to do something clever with
            # redirects, we set the Host: header above already.
            proxy_redirect off;

            # set "proxy_buffering off" *only* for Rainbows! when doing
            # Comet/long-poll/streaming.  It's also safe to set if you're using
            # only serving fast clients with Unicorn + nginx, but not slow
            # clients.  You normally want nginx to buffer responses to slow
            # clients, even with Rails 3.1 streaming because otherwise a slow
            # client can become a bottleneck of Unicorn.
            #
            # The Rack application may also set "X-Accel-Buffering (yes|no)"
            # in the response headers do disable/enable buffering on a
            # per-response basis.
            # proxy_buffering off;






            client_max_body_size       10m;
            client_body_buffer_size    128k;

            proxy_connect_timeout      10;
            proxy_send_timeout         5;
            proxy_read_timeout         3600;

            proxy_buffer_size          4k;
            proxy_buffers              4 132k;
            proxy_busy_buffers_size    264k;
            proxy_temp_file_write_size 164k;
            proxy_pass http://index;            


            #proxy_set_header Authorization base64_encoding_of_"user:password";
            #proxy_pass_header Server;
            proxy_set_header Host $http_host;
        }



        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                # handles legacy scripts
                if (!-f $request_filename) {
                        rewrite ^/(.*)$ /index.php?routestring=$1 break;
                }

                fastcgi_split_path_info ^(.+\.php)(.*)$;
                fastcgi_pass   127.6.145.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
                fastcgi_param QUERY_STRING $query_string;
                fastcgi_param REQUEST_METHOD $request_method;
                fastcgi_param CONTENT_TYPE $content_type;
                fastcgi_param CONTENT_LENGTH $content_length;
                fastcgi_intercept_errors on;
                fastcgi_ignore_client_abort off;
                fastcgi_connect_timeout 60;
                fastcgi_send_timeout 180;
                fastcgi_read_timeout 180;
                fastcgi_buffers 256 16k;
                fastcgi_buffer_size 32k;
                fastcgi_temp_file_write_size 256k;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

但它不能正常工作。我收到此错误:

2016/01/04 17:49:05 [notice] 375279#0: OS: Linux 2.6.32-573.12.1.el6.x86_64
2016/01/04 17:49:05 [notice] 375279#0: getrlimit(RLIMIT_NOFILE): 1024:16384
2016/01/04 17:49:05 [notice] 375304#0: start worker processes
2016/01/04 17:49:05 [notice] 375304#0: start worker process 375306
2016/01/04 17:49:16 [notice] 375306#0: *7 "^/(.*)$" matches "/forum.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum.php HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:49:16 [notice] 375306#0: *7 rewritten data: "/index.php", args: "routestring=forum.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum.php HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:49:16 [error] 375306#0: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum.php HTTP/1.1", upstream: "fastcgi://127.6.145.1:9000", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:02 [notice] 379852#0: using the "epoll" event method
2016/01/04 17:51:02 [notice] 379852#0: nginx/1.6.0
2016/01/04 17:51:02 [notice] 379852#0: built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 
2016/01/04 17:51:02 [notice] 379852#0: OS: Linux 2.6.32-573.12.1.el6.x86_64
2016/01/04 17:51:02 [notice] 379852#0: getrlimit(RLIMIT_NOFILE): 1024:16384
2016/01/04 17:51:02 [notice] 379855#0: start worker processes
2016/01/04 17:51:02 [notice] 379855#0: start worker process 379856
2016/01/04 17:51:08 [notice] 379856#0: *1 "^/(.*)$" matches "/www", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /www HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:08 [notice] 379856#0: *1 rewritten data: "/index.php", args: "routestring=www", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /www HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:08 [notice] 379856#0: *1 "^/(.*)$" matches "/index.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /www HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:08 [notice] 379856#0: *1 rewritten data: "/index.php", args: "routestring=index.php&routestring=www", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /www HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:08 [error] 379856#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /www HTTP/1.1", upstream: "fastcgi://127.6.145.1:9000", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:13 [notice] 379856#0: *3 "^/(.*)$" matches "/forum", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:13 [notice] 379856#0: *3 rewritten data: "/index.php", args: "routestring=forum", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:13 [notice] 379856#0: *3 "^/(.*)$" matches "/index.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:13 [notice] 379856#0: *3 rewritten data: "/index.php", args: "routestring=index.php&routestring=forum", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:13 [error] 379856#0: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum HTTP/1.1", upstream: "fastcgi://127.6.145.1:9000", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:17 [notice] 379856#0: *3 "^/(.*)$" matches "/", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET / HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:17 [notice] 379856#0: *3 rewritten data: "/index.php", args: "routestring=", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET / HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:17 [notice] 379856#0: *3 "^/(.*)$" matches "/index.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET / HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:17 [notice] 379856#0: *3 rewritten data: "/index.php", args: "routestring=index.php&routestring=", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET / HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:17 [error] 379856#0: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.6.145.1:9000", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:17 [notice] 379856#0: *6 "^/(.*)$" matches "/www", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /www HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:17 [notice] 379856#0: *6 rewritten data: "/index.php", args: "routestring=www", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /www HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:17 [notice] 379856#0: *6 "^/(.*)$" matches "/index.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /www HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:17 [notice] 379856#0: *6 rewritten data: "/index.php", args: "routestring=index.php&routestring=www", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /www HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:17 [error] 379856#0: *6 connect() failed (111: Connection refused) while connecting to upstream, client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /www HTTP/1.1", upstream: "fastcgi://127.6.145.1:9000", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:19 [notice] 379856#0: *3 "^/(.*)$" matches "/", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET / HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:19 [notice] 379856#0: *3 rewritten data: "/index.php", args: "routestring=", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET / HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:19 [notice] 379856#0: *3 "^/(.*)$" matches "/index.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET / HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:19 [notice] 379856#0: *3 rewritten data: "/index.php", args: "routestring=index.php&routestring=", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET / HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:51:19 [error] 379856#0: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.6.145.1:9000", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:52:56 [notice] 384714#0: using the "epoll" event method
2016/01/04 17:52:56 [notice] 384714#0: nginx/1.6.0
2016/01/04 17:52:56 [notice] 384714#0: built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 
2016/01/04 17:52:56 [notice] 384714#0: OS: Linux 2.6.32-573.12.1.el6.x86_64
2016/01/04 17:52:56 [notice] 384714#0: getrlimit(RLIMIT_NOFILE): 1024:16384
2016/01/04 17:52:56 [notice] 384716#0: start worker processes
2016/01/04 17:52:56 [notice] 384716#0: start worker process 384717
2016/01/04 17:53:18 [notice] 384717#0: *15 "^/(.*)$" matches "/forum.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum.php HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:53:18 [notice] 384717#0: *15 rewritten data: "/index.php", args: "routestring=forum.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum.php HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:53:18 [error] 384717#0: *15 connect() failed (111: Connection refused) while connecting to upstream, client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum.php HTTP/1.1", upstream: "fastcgi://127.6.145.1:9000", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:54:35 [notice] 389310#0: using the "epoll" event method
2016/01/04 17:54:35 [notice] 389310#0: nginx/1.6.0
2016/01/04 17:54:35 [notice] 389310#0: built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 
2016/01/04 17:54:35 [notice] 389310#0: OS: Linux 2.6.32-573.12.1.el6.x86_64
2016/01/04 17:54:35 [notice] 389310#0: getrlimit(RLIMIT_NOFILE): 1024:16384
2016/01/04 17:54:35 [notice] 389312#0: start worker processes
2016/01/04 17:54:35 [notice] 389312#0: start worker process 389313
2016/01/04 17:54:38 [notice] 389313#0: *1 "^/(.*)$" matches "/forum", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:54:38 [notice] 389313#0: *1 rewritten data: "/index.php", args: "routestring=forum", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:54:38 [notice] 389313#0: *1 "^/(.*)$" matches "/index.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:54:38 [notice] 389313#0: *1 rewritten data: "/index.php", args: "routestring=index.php&routestring=forum", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:54:38 [error] 389313#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum HTTP/1.1", upstream: "fastcgi://127.6.145.1:9000", host: "diy-elasa2.rhcloud.com"
2016/01/04 17:56:30 [notice] 394970#0: using the "epoll" event method
2016/01/04 17:56:30 [notice] 394970#0: nginx/1.6.0
2016/01/04 17:56:30 [notice] 394970#0: built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 
2016/01/04 17:56:30 [notice] 394970#0: OS: Linux 2.6.32-573.12.1.el6.x86_64
2016/01/04 17:56:30 [notice] 394970#0: getrlimit(RLIMIT_NOFILE): 1024:16384
2016/01/04 17:56:30 [notice] 394971#0: start worker processes
2016/01/04 17:56:30 [notice] 394971#0: start worker process 394972
2016/01/04 18:02:37 [notice] 417803#0: using the "epoll" event method
2016/01/04 18:02:37 [notice] 417803#0: nginx/1.6.0
2016/01/04 18:02:37 [notice] 417803#0: built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 
2016/01/04 18:02:37 [notice] 417803#0: OS: Linux 2.6.32-573.12.1.el6.x86_64
2016/01/04 18:02:37 [notice] 417803#0: getrlimit(RLIMIT_NOFILE): 1024:16384
2016/01/04 18:02:37 [notice] 417938#0: start worker processes
2016/01/04 18:02:37 [notice] 417938#0: start worker process 417982
2016/01/04 18:02:52 [info] 417982#0: *5 client 127.6.145.1 closed keepalive connection
2016/01/04 18:03:06 [info] 417982#0: *1 client 127.6.145.1 closed keepalive connection
2016/01/04 18:03:06 [info] 417982#0: *2 client 127.6.145.1 closed keepalive connection
2016/01/04 18:03:28 [notice] 417982#0: *47 "^/(.*)$" matches "/forum.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum.php HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 18:03:28 [notice] 417982#0: *47 rewritten data: "/index.php", args: "routestring=forum.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum.php HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 18:03:28 [error] 417982#0: *47 connect() failed (111: Connection refused) while connecting to upstream, client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum.php HTTP/1.1", upstream: "fastcgi://127.6.145.1:9000", host: "diy-elasa2.rhcloud.com"
2016/01/04 18:03:39 [info] 417982#0: *23 client 127.6.145.1 closed keepalive connection
2016/01/04 18:04:30 [info] 417982#0: *47 client 127.6.145.1 closed keepalive connection
2016/01/04 18:05:30 [info] 417982#0: *49 client 127.6.145.1 closed keepalive connection
2016/01/04 18:05:57 [notice] 444106#0: using the "epoll" event method
2016/01/04 18:05:57 [notice] 444106#0: nginx/1.6.0
2016/01/04 18:05:57 [notice] 444106#0: built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) 
2016/01/04 18:05:57 [notice] 444106#0: OS: Linux 2.6.32-573.12.1.el6.x86_64
2016/01/04 18:05:57 [notice] 444106#0: getrlimit(RLIMIT_NOFILE): 1024:16384
2016/01/04 18:05:57 [notice] 444107#0: start worker processes
2016/01/04 18:05:57 [notice] 444107#0: start worker process 444108
2016/01/04 18:06:06 [notice] 444108#0: *1 "^/(.*)$" matches "/forum.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum.php HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 18:06:06 [notice] 444108#0: *1 rewritten data: "/index.php", args: "routestring=forum.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum.php HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 18:06:06 [error] 444108#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum.php HTTP/1.1", upstream: "fastcgi://127.6.145.1:9000", host: "diy-elasa2.rhcloud.com"
2016/01/04 18:06:16 [notice] 444108#0: *1 "^/(.*)$" matches "/forum.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum.php HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 18:06:16 [notice] 444108#0: *1 rewritten data: "/index.php", args: "routestring=forum.php", client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum.php HTTP/1.1", host: "diy-elasa2.rhcloud.com"
2016/01/04 18:06:16 [error] 444108#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 188.158.90.71, server: diy-elasa2.rhcloud.com, request: "GET /forum.php HTTP/1.1", upstream: "fastcgi://127.6.145.1:9000", host: "diy-elasa2.rhcloud.com"

那么你怎么看!!!php-fpm 工作正常,可以通过此链接进行检查:

http://diy-elasa2.rhcloud.com/phpinfo.php

答案1

所以我终于找到了答案,从 nginx 服务器连接 vbulletin 的正确配置可能类似于以下代码:

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
error_log /var/lib/openshift/568adf5a0c1e66dac3000283/app-root/logs/nginx_error.log debug;

pid        /var/lib/openshift/568adf5a0c1e66dac3000283/app-root/runtime/srv/nginx/logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;
    #access_log $OPENSHIFT_DIY_LOG_DIR/access.log main;
    port_in_redirect off;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  165;

    gzip  on;

    upstream frontends {
        #server pr4ss.tk;
        #server 222.66.115.233:80 weight=1;
        #server 127.6.145.1:8081 ;
        server vb2-fishsmarkets.rhcloud.com;

    }
    upstream frontends2 {
        server vb2-fishsmarkets.rhcloud.com;
        #server 222.66.115.233:80 weight=1;
        #server 127.6.145.1:8081 ;

    }
    upstream index {
        #server  community.elasa.ir;
        server vb2-fishsmarkets.rhcloud.com;
        #server 127.6.145.1:15001 weight=1;
        #server 127.6.145.1:15002 weight=2;
        #server 127.6.145.1:15002 weight=3;

    }
    upstream comment {
        server vb2-fishsmarkets.rhcloud.com;
        #server  community.elasa.ir;
    }

    server {
        listen      127.6.145.1:8080;
        server_name  diy-elasa2.rhcloud.com www.diy-elasa2.rhcloud.com;
        root /var/lib/openshift/568adf5a0c1e66dac3000283/app-root/runtime/repo/www;


        set_real_ip_from 127.6.145.1;
        real_ip_header X-Forwarded-For;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;
         location ~* ^/comment/(.*) {
            proxy_set_header HOST vb2-fishsmarkets.rhcloud.com;
            # $1 - stores capture from the location on top
            # $is_args will return ? if there are query params
            # $args stores query params
            proxy_pass http://comment/$1$is_args$args;
        }
        location ~* ^/(.*) {
            proxy_set_header Host vb2-fishsmarkets.rhcloud.com;
            proxy_redirect  http://vb2-fishsmarkets.rhcloud.com/ http://diy-elasa2.rhcloud.com/;
            proxy_pass http://comment/$1$is_args$args;
        }
        location /main {
            root   /var/lib/openshift/568adf5a0c1e66dac3000283/app-root/runtime/repo/www;
            index  index.html index.htm;
            try_files $uri $uri/ =404;

            autoindex on;
            autoindex_exact_size off;
            autoindex_localtime on;

            #proxy_set_header Authorization base64_encoding_of_"user:password";
            #proxy_pass_header Server;
            #proxy_set_header Host $http_host;
            proxy_set_header Host http://community.elasa.ir:80;
            #proxy_redirect off;
            proxy_set_header  X-Real-IP  $remote_addr;
            proxy_set_header X-Scheme $scheme;
            #proxy_pass http://frontends;
            #proxy_redirect community.elasa.ir;

        }
        location /forum\.php {
                if (!-f $request_filename) {
                        rewrite ^/(.*)$ /index.php?routestring=$1 last;
                }
                autoindex on;
            autoindex_exact_size off;
            autoindex_localtime on;

            #proxy_set_header Authorization base64_encoding_of_"user:password";
            #proxy_pass_header Server;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_set_header  X-Real-IP  $remote_addr;
            proxy_set_header X-Scheme $scheme;
            proxy_pass http://frontends;
        }
        location /forum2 {
            #root   /var/lib/openshift/568adf5a0c1e66dac3000283/app-root/runtime/repo/www;
            index  index.html index.htm;

            autoindex on;
            autoindex_exact_size off;
            autoindex_localtime on;

            #proxy_set_header Authorization base64_encoding_of_"user:password";
            #proxy_pass_header Server;
            #proxy_set_header Host $http_host;
            #proxy_redirect off;
            proxy_set_header Host http://community.elasa.ir:80;
            #proxy_set_header  X-Real-IP  $remote_addr;
            #proxy_set_header X-Scheme $scheme;
            proxy_pass http://frontends;
        }
        location /categories {
            #root   /var/lib/openshift/568adf5a0c1e66dac3000283/app-root/runtime/repo/www;
            index  index.html index.htm;

            autoindex on;
            autoindex_exact_size off;
            autoindex_localtime on;

            #proxy_set_header Authorization base64_encoding_of_"user:password";
            #proxy_pass_header Server;
            proxy_set_header Host $http_host;
            proxy_redirect off;
            proxy_set_header  X-Real-IP  $remote_addr;
            proxy_set_header X-Scheme $scheme;
            proxy_pass http://frontends2;
        }
        location /index {
            #root   /var/lib/openshift/568adf5a0c1e66dac3000283/app-root/runtime/repo/www;
            index  index.html index.htm;

            autoindex on;
            autoindex_exact_size off;
            autoindex_localtime on;
            # an HTTP header important enough to have its own Wikipedia entry:
            #   http://en.wikipedia.org/wiki/X-Forwarded-For
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;


            # enable this if you forward HTTPS traffic to unicorn,
            # this helps Rack set the proper URL scheme for doing redirects:
            # proxy_set_header X-Forwarded-Proto $scheme;

            # pass the Host: header from the client right along so redirects
            # can be set properly within the Rack application
            proxy_set_header Host $http_host;

            # we don't want nginx trying to do something clever with
            # redirects, we set the Host: header above already.
            proxy_redirect off;

            # set "proxy_buffering off" *only* for Rainbows! when doing
            # Comet/long-poll/streaming.  It's also safe to set if you're using
            # only serving fast clients with Unicorn + nginx, but not slow
            # clients.  You normally want nginx to buffer responses to slow
            # clients, even with Rails 3.1 streaming because otherwise a slow
            # client can become a bottleneck of Unicorn.
            #
            # The Rack application may also set "X-Accel-Buffering (yes|no)"
            # in the response headers do disable/enable buffering on a
            # per-response basis.
            # proxy_buffering off;






            client_max_body_size       10m;
            client_body_buffer_size    128k;

            proxy_connect_timeout      10;
            proxy_send_timeout         5;
            proxy_read_timeout         3600;

            proxy_buffer_size          4k;
            proxy_buffers              4 132k;
            proxy_busy_buffers_size    264k;
            proxy_temp_file_write_size 164k;
            proxy_pass http://index;            


            #proxy_set_header Authorization base64_encoding_of_"user:password";
            #proxy_pass_header Server;
            proxy_set_header Host $http_host;
        }

        location /index2 {
            #root   /var/lib/openshift/568adf5a0c1e66dac3000283/app-root/runtime/repo/www;
            index  index.html index.htm;

            autoindex on;
            autoindex_exact_size off;
            autoindex_localtime on;
            # an HTTP header important enough to have its own Wikipedia entry:
            #   http://en.wikipedia.org/wiki/X-Forwarded-For
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;


            # enable this if you forward HTTPS traffic to unicorn,
            # this helps Rack set the proper URL scheme for doing redirects:
            # proxy_set_header X-Forwarded-Proto $scheme;

            # pass the Host: header from the client right along so redirects
            # can be set properly within the Rack application
            proxy_set_header Host $http_host;

            # we don't want nginx trying to do something clever with
            # redirects, we set the Host: header above already.
            #proxy_redirect http://community.elasa.ir:80;


            # set "proxy_buffering off" *only* for Rainbows! when doing
            # Comet/long-poll/streaming.  It's also safe to set if you're using
            # only serving fast clients with Unicorn + nginx, but not slow
            # clients.  You normally want nginx to buffer responses to slow
            # clients, even with Rails 3.1 streaming because otherwise a slow
            # client can become a bottleneck of Unicorn.
            #
            # The Rack application may also set "X-Accel-Buffering (yes|no)"
            # in the response headers do disable/enable buffering on a
            # per-response basis.
            # proxy_buffering off;






            client_max_body_size       10m;
            client_body_buffer_size    128k;

            proxy_connect_timeout      10;
            proxy_send_timeout         5;
            proxy_read_timeout         3600;

            proxy_buffer_size          4k;
            proxy_buffers              4 132k;
            proxy_busy_buffers_size    264k;
            proxy_temp_file_write_size 164k;
            proxy_pass http://index;            


            #proxy_set_header Authorization base64_encoding_of_"user:password";
            #proxy_pass_header Server;
            proxy_set_header Host $http_host;
        }


        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                # handles legacy scripts
                if (!-f $request_filename) {
                        rewrite ^/(.*)$ /index.php?routestring=$1 break;
                }

                fastcgi_split_path_info ^(.+\.php)(.*)$;
                fastcgi_pass   127.6.145.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
                fastcgi_param QUERY_STRING $query_string;
                fastcgi_param REQUEST_METHOD $request_method;
                fastcgi_param CONTENT_TYPE $content_type;
                fastcgi_param CONTENT_LENGTH $content_length;
                fastcgi_intercept_errors on;
                fastcgi_ignore_client_abort off;
                fastcgi_connect_timeout 60;
                fastcgi_send_timeout 180;
                fastcgi_read_timeout 180;
                fastcgi_buffers 256 16k;
                fastcgi_buffer_size 32k;
                fastcgi_temp_file_write_size 256k;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}




    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

并且其必须包含:

location ~* ^/(.*) {
        proxy_set_header Host vb2-fishsmarkets.rhcloud.com;
        proxy_redirect  http:// vb2-fishsmarkets.rhcloud.com/ http:// diy-elasa2.rhcloud.com/;
        proxy_pass http://comment/$1$is_args$args;

sub_filter '<base href="http://community2.elasa.ir/'   '<base href="http://community.elasa.ir/';
            sub_filter_once on;
    }

和 :

upstream comment {
        server vb2-fishsmarkets.rhcloud.com;
        #server  community.elasa.ir;
    }

因此,为了访问管理面板必须添加以下行:

if ($host = 'vb-elasa3.rhcloud.com' ) {
                return 302 https://community.elasa.ir$request_uri;
            }

相关内容