【发布时间】:2017-06-26 17:09:11
【问题描述】:
如何在 ubuntu 服务器上的 Apache 中设置子域。
我的 apache.conf 文件:
<VirtualHost *:80>
ServerName www.hello.com
DocumentRoot /var/www/html/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:81>
ServerName bye.hello.com
DocumentRoot /var/www/html/other
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
现在我通过 IP 访问:10.20.20.34:80 (www.hello.com) 和 10.20.20.34:81 (bye.hello.com)。 80 端口很好用,但我无法为 81 端口设置子域。
我们不需要公共访问,一切都在 Intranet 上。我们修改了路由器中的 DNS 记录。
重要提示:我必须同时保留访问权限:10.20.20.34:81 和 bye.hello.com
以下是所发生情况的摘要:
- 10.20.20.34:80 - 好的。
- 10.20.20.34:81 - 好的。
- www.hello.com - 好的。
- bye.hello.com - 失败,请显示 www.hello.com
【问题讨论】:
标签: apache .htaccess ubuntu dns subdomain