https://blog.csdn.net/fly_xiaoba/article/details/49592943
//创建两个网站的目录结构及测试用页面文件
- # 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>
转载请注明出处:
转载自http://lxfamn.cn/blog
未经允许不得转载:lxfamn » linux centos 配置虚拟主机