【发布时间】:2019-07-09 01:56:52
【问题描述】:
我想使用 nginx 从 1 个 IP 地址创建多个子域。所以它会是这样的:
http://demo1.192.168.0.27
http://demo2.192.168.0.27
以前有人问过这个问题。
nginx - two subdomain configuration
我尝试了同样的方法,但我无法做到。
这是我的代码:
events {
}
http {
server {
server_name demo1.192.167.0.27;
root /data/sites/demo1;
index index.html;
location / {
try_files $uri $uri/ /404.html;
}
}
server {
server_name demo2.192.167.0.27;
root /data/sites/demo2;
index index.html;
location / {
try_files $uri $uri/ /404.html;
}
}
}
当我去
http://demo1.192.168.0.27
http://demo2.192.168.0.27
它说,这个网站无法访问
不知道为什么它不适合我。
【问题讨论】:
标签: nginx