CentOS7配置Apache多站点VirtualHost

来源:互联网 发布:sql数据库软件 编辑:程序博客网 时间:2024/05/19 09:13

//创建两个网站的目录结构及测试用页面文件

# mkdir /www/test1# echo "test1" > /www/test1/index.html# mkdir /www/test2# echo "test2" > /www/test2/index.html

 //配置虚拟机主机

# cd /etc/httpd/# mkdir vhost-conf.d# echo "Includevhost-conf.d/*.conf" >> conf/httpd.conf# vi /etc/httpd/vhost-conf.d/vhost-name.conf

//添加如下内容

<VirtualHost *:80>   ServerName example1.com   ServerAlias example1.com www.example1.com   DocumentRoot /var/www/test1/   DirectoryIndex index.html index.php</VirtualHost><Directory "/var/www/test1/">   Options +Includes -Indexes   AllowOverride All   Order Deny,Allow   Allow from All</Directory><VirtualHost *:80>   ServerName example2.com   ServerAlias example2.com www.example2.com   DocumentRoot /var/www/test2/   DirectoryIndex index.html index.php</VirtualHost><Directory "/var/www/test2/“>   Options +Includes -Indexes   AllowOverride All   Order Deny,Allow   Allow from All</Directory>

0 0
原创粉丝点击