我有多个网站和服务的以下目录结构
/var/www/html/site1
/var/www/html/site2
/var/www/html/site3
/var/www/html/serv1
/var/www/html/serv2
site1
文件夹托管一个网站site1domain.com
,我想公开托管在serv1
和serv2
文件夹中的 webapp 服务,以便将它们显示为
service1.site1domain.com
service2.site1domain.com
所以我尝试以site1domain.conf
这种方式在文件中配置虚拟主机
<VirtualHost *:80>
ServerName site1domain.com
ServerAlias www.site1domain.com
DocumentRoot /var/www/html/site1
<Directory /var/www/html/site1>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName service1.site1domain.com
ProxyPreserveHost On
ProxyRequest Off
ProxyPass "/" "localhost/serv1"
ProxyPassReverse "/" "localhost/serv1"
</VirtualHost>
<VirtualHost *:80>
ServerName service2.site1domain.com
ProxyPreserveHost On
ProxyRequest Off
ProxyPass "/" "localhost/serv2"
ProxyPassReverse "/" "localhost/serv2"
</VirtualHost>
但是与服务相关的虚拟主机代码块导致服务器崩溃:exit with error code 1。
有人可以帮助我了解如何正确配置它们吗?