【发布时间】:2016-03-10 06:50:12
【问题描述】:
我想向托管在nginx 的网站添加子域。为此,我将子域名添加到 nginx.conf 文件中。但是每当我尝试访问本地主机之外的子域时,它都会将我重定向到http://id.domain-error.com/noresult.php。
这是我的nginx.conf 文件:
http {
server {
listen 80; # Incoming port for Nginx
server_name www.example.com example.com;
index index.html index.htm;
location / {
root /usr/share/nginx/example;
try_files $uri $uri/ =404;
}
}
server {
listen 80; # Incoming port for Nginx
server_name hello.example.com;
index index.html index.htm;
location / {
root /usr/share/nginx/some_other_example;
try_files $uri $uri/ =404;
}
}
}
谁能告诉我这里缺少什么?
【问题讨论】:
-
您是否已将它们添加到 DNS 中?
-
那是错误。完全忘记添加了。刚刚添加了
*.example.com,它起作用了。谢谢。
标签: ubuntu nginx configuration server