![centos配置虚拟主机 centos配置虚拟主机](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
首先注释掉 DocumentRoot /var/www/html
然后添加如下代码至文件底部:
NameVirtualHost 192.168.0.3
<virtualhost 192.168.0.3>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/website2
ServerName www.website2.com
ErrorLog /var/www/html/website2/logs/error_log
TransferLog /var/www/html/website2/logs/access_log
</virtualhost>