【发布时间】:2011-10-13 18:48:25
【问题描述】:
我关注了这些instructions to configure subdomains for apache。我可以使用http://localhost/test 访问子域,尽管我无法通过http://test.localhost 访问它。如何实现后者?
# /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>
【问题讨论】:
-
当您按照描述进行操作时,它应该可以工作。那么你错过了什么?
-
您是否将
test.localhost添加到您的主机文件以确保它解析为 127.0.0.1? -
@Marc B - 谢谢!我按照教程中的描述将子域配置为 127.0.0.2。现在它起作用了!请让我给你答案标志。
标签: apache configuration dns subdomain virtualhost