我跟着这些instructions to configure subdomains for apache。我可以用http://localhost/test
访问子域,虽然我无法通过http://test.localhost
访问它。我怎样才能实现后者?如何在Ubuntu上为Apache2配置子域名?
# /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>
当你跟着说明,它应该工作。那么你错过了什么? – KingCrunch
您是否已将'test.localhost'添加到您的主机文件以确保它解析为127.0.0.1? –
@Marc B - 谢谢!我按照教程中的描述将子域配置为127.0.0.2。现在它工作了!请让我给你答案标志。 – JJD