Hos将与Nginx中的子域一起工作?

Hos将与Nginx中的子域一起工作?,nginx,Nginx,我有一个配置文件: server { #listen 80; server_name a.localhost; location /tiles/ { root www; allow all; } } server { listen 80; server_name localhost; root /www/data; #location / { #}

我有一个配置文件:

server {
    #listen       80;
    server_name  a.localhost;

    location /tiles/ {
        root www;
        allow all;
    }
}

 server {
    listen       80;
    server_name  localhost;

    root /www/data;

    #location / {
    #}

    location /tiles/ {
        root www;
        allow all;
    }

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        root   www;
        allow all;
        index  index.html index.htm;
    }
}
我对静态图像内容使用子域。我的网址:

http://{s}.localhost/tiles/{z}/{x}/{y}.png
现在我想在本地网络中访问此服务器。因此,我将localhost更改为我的IP

server {
    listen       192.168.80.131:80;
    server_name  a.localhost a.192.168.80.131;

    location /tiles/ {
        root www;
        allow all;
    }
}

 server {
    listen       192.168.80.131:80;
    server_name  localhost 192.168.80.131;

    root /www/data;

    #location / {
    #}

    location /tiles/ {
        root www;
        allow all;
    }

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        root   www;
        allow all;
        index  index.html index.htm;
    }
}

在浏览器中,我转到地址
http://192.168.80.131/leaflet/index.html
并获取我的页面。但不会出现静态连接。在控制台中,我得到了错误:

获取网络::错误\u名称\u未\u解析

在错误日志中,我没有看到任何错误。
Wnat可能出错?

a.192.168.80.131
看起来不像IP地址或域名。“我不明白你希望这个名字如何解析。@RichardSmith,当我使用
a.localhost
作为子域时,它就起作用了。”。所以我只是将localhost改为ip。如果决定子域名使用什么是错误的?您可以使用运行浏览器的计算机上的
hosts
文件将名称映射到IP地址。@RichardSmith i在主机文件中添加了行'192.168.80.131 test'。但子域仍然抛出相同的错误。