Nginx子域(和域)无法正常工作

时间:2014-08-20 11:24:21

标签: nginx

我在Windows 7 x32和我的nginx文件:

worker_processes  1;

events {
    worker_connections  1024;
}


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

    sendfile        on;

    keepalive_timeout  65;

    gzip  on;
    upstream app_opencubes {
        server 127.0.0.1:1234;
    }   

    server {
        listen       80;
        server_name  www.opencubes.io opencubes.io;

        #charset koi8-r;
        access_log  logs/host.access.log;
        location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;

            proxy_pass http://app_opencubes/;
            proxy_redirect off;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }


    }
    server {
        listen       80;
        server_name  my.opencubes.io;

        #charset koi8-r;
        access_log  logs/host.access.log;
        location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;

            proxy_pass http://app_opencubes/dashboard/;
            proxy_redirect off;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }


    }


}

每当我尝试访问opencubes.iomy.opencubes.io时,我的浏览器都说无法加载网址。但是,当我尝试localhost时,它可以工作

1 个答案:

答案 0 :(得分:0)

好的我需要将其添加到C:/window/system32/drivers/hosts

127.0.0.1       opencubes.io
127.0.0.1       my.opencubes.io