我在/etc/httpd/conf.d/vhost.conf
的虚拟主机配置如下所示:
NameVirtualHost *
<VirtualHost *>
ServerName www.example.com
DocumentRoot /var/www/html/site
</VirtualHost>
<VirtualHost *>
ServerName en.example.com
DocumentRoot /var/www/html/english
</VirtualHost>
<VirtualHost *>
ServerName photo.example.com
DocumentRoot /var/www/html/photo
</VirtualHost>
<VirtualHost *>
ServerName music.example.com
DocumentRoot /var/www/html/music
</VirtualHost>
<VirtualHost *>
ServerName video.example.com
DocumentRoot /var/www/html/video
</VirtualHost>
现在,只有www.example.com
在/var/www/html/site
显示正确的网站。所有其他子域名都提供500 internal server error
。我做错了什么?
更新:
我真的很抱歉...我的域名家伙向我确认我的域名被正确路由到我的IP地址....只有在我做了dig en.example.com
之后(我之前应该做的很多)我是否意识到我的域名员工做了一个愚蠢的错误配置...网址甚至没有达到我的IP地址开始...真的很抱歉麻烦的人:( :( - 这个vhost.conf
文件是好的
答案 0 :(得分:1)
# Ensure that Apache listens on port 80
Listen 80
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /var/www/html/site
</VirtualHost>
<VirtualHost *:80>
ServerName en.example.com
DocumentRoot /var/www/html/english
</VirtualHost>
<VirtualHost *:80>
ServerName photo.example.com
DocumentRoot /var/www/html/photo
</VirtualHost>
<VirtualHost *:80>
ServerName music.example.com
DocumentRoot /var/www/html/music
</VirtualHost>
<VirtualHost *:80>
ServerName video.example.com
DocumentRoot /var/www/html/video
</VirtualHost>