如何在Ubuntu上配置的Apache2子域? [英] How to configure subdomains for Apache2 on Ubuntu?
本文介绍了如何在Ubuntu上配置的Apache2子域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我按照这些说明配置为Apache 子域。我可以通过访问子域的http://本地主机/测试
虽然我无法通过 HTTP访问://test.localhost
。我怎样才能实现后者?
#/etc/apache2/sites-available/test.localhost
<虚拟主机*:80> # 服务器名称
服务器名test.localhost #文档根
的DocumentRoot的/ var / WWW /测试/ #自定义日志文件的位置
错误日志/var/www/test/logs/error.log
的CustomLog /var/www/test/logs/access.log结合< /虚拟主机>
解决方案
由于标记B 已经回答正确的问题是在错误配置/ etc / hosts中
。正确的配置是:
#/ etc / hosts文件
127.0.0.1 test.localhost
I followed these instructions to configure subdomains for apache. I can access the subdomain using http://localhost/test
though I cannot access it via http://test.localhost
. How can I realize the latter?
# /etc/apache2/sites-available/test.localhost
<VirtualHost *:80>
# Server name
ServerName test.localhost
# Document root
DocumentRoot /var/www/test/
# Custom log file locations
ErrorLog /var/www/test/logs/error.log
CustomLog /var/www/test/logs/access.log combined
</VirtualHost>
解决方案
As Mark B already answered correctly the problem was a misconfiguration in /etc/hosts
. The correct configuration is:
# /etc/hosts
127.0.0.1 test.localhost
这篇关于如何在Ubuntu上配置的Apache2子域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文