Linux虚拟主机域名解析/文件解析
1、域名解析 /文件解析不能使用DNS解析,这里我们采用文件解析的方法找到下面目录下的文件C:\Windows\System32\drivers\etc\hosts192.168.164.191 www.sina.com192.168.164.191 www.sohu.com写入进去之后 保存

2、网站目录规划#mkdir /share/sina/#mkdir /share/sohu/

4、修改主配置文件改掉<VirtualHost 后面的ip修改下一行的管理员邮箱再改网站下面的根目录DocumentRoot "/share/sina"删除servername下的,网站别名,避免干扰最终改为23 <VirtualHost 192.168.164.191>26 ServerName www.sina.com27 ErrorLog "logs/sina-error_log"28 CustomLog "logs/sina-access_log" common29 </VirtualHost>30 31 <VirtualHost 192.168.164.191>32 ServerAdmin webmaster@dummy-host.sohu.com33 DocumentRoot "/share/sohu" 34 ServerName www.sohu.com 35 ErrorLog "logs/sohu-error_log"36 CustomLog "logs/sohu-access_log" common37 </VirtualHost>

5、# vim ../httpd.conf 在这个目录里面有一些权限跟着前面要附加上权限24 <Directory "/share/sina">25 Options Indexes26 AllowOverride None27 Require all granted28 </Directory>29 30 <Directory "/share/sohu">31 Options Indexes32 AllowOverride None33 Require all granted34 </Directory>

