2015-09-25 23 views
0

运行Nginx的刚开始玩nginx的,第一次和一个子域相关的问题上来。 我配置默认的nginx服务器(在的/ etc/nginx的/网站可用/默认),看起来像这样:无法解析本地子域,在树莓派

server { 

    root /usr/share/nginx/www; 
    index index.html index.htm; 

    # Make site accessible from http://localhost/ 
    server_name localhost; 

    location/{ 
    try_files $uri.html $uri $uri/ =404; 
    } 

    location /doc/ { 
    alias /usr/share/doc/; 
    autoindex on; 
    allow 127.0.0.1; 
    allow ::1; 
    deny all; 
    } 
} 

紧接着的第二个服务器,我想成为一个子域:

server { 
    listen 80; 
    server_name subdomain.localhost; 
    root /usr/share/nginx/subdomain; 
    index index.html index.htm; 

    location/{ 
     proxy_pass http://127.0.0.1:2368/; 
     proxy_set_header Host $host; 
     proxy_buffering off; 

    } 
} 

增加了新的条目/etc/hosts文件127.0.0.1 subdomain.localhost

我仍然可以ping通,卷曲身体分通过ssh domain.localhost但我无法通过浏览器(http://subdomain.raspberrypi/http://subdomain.192.168.1.184/) 解决它,一切都很好,当我进入我的主要领域。

任何想法如何使这项工作? 谢谢。

回答

0

添加到您使用浏览的机器上的主机 192.168.1.184 subdomain.rpi