Apache Centos多站点配置
centos 中apache配置文件路径为/etc/httpd/conf/httpd.conf
最后一行为"IncludeOptional conf.d/*.conf",会自动加载/etc/httpd/conf.d/下的所有conf文件 。
所以只需在conf.d文件中创建.conf文件即可。
例如:my.conf 文件内容如下
NameVirtualHost *:80
<VirtualHost *:80>
#Created by zhongjin on 2016-12-21 冬至
Serveradmin 1144943524@qq.com
ServerName www.haoai.com
DocumentRoot /var/www/html/haoai
<Directory "/var/www/html/haoai">
Options FollowSymLinks
AllowOverride All
#Require all denied
Require all granted
</Directory>
</VirtualHost>
注:其中
“NameVirtualHost *:80” 是多个.conf文件仅声明1次,多个不再声明
“ServerName” 修改为域名
“ DocumentRoot”与“Directory”修改问项目目录