apache虚拟主机配置

1. 检查配置/etc/httpd/conf/httpd.conf

查看虚拟主机 httpd -S

  • 去掉 NameVirtualHost *:80 前的#
  • 去掉 ServerName 前的#

2. 虚拟主机配置代码

# Ensure that Apache listens on port 80
Listen 80
<VirtualHost *:80>
DocumentRoot "/www/example1"
    ServerName www.example.com

# Other directives here
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "/www/example2"
    ServerName www.example.org

# Other directives here
</VirtualHost>
标签:Apache 发布于:2019-10-01 14:17:24