第二十九讲 apache服务器使用及配置④ apache虚拟主机 web访问时序图
1、虚拟主机的配置
在现实中,我们不可能访问 http://localhost/news.html 这样的网站
通常是访问 http://www.sohu.com
http://www.taobao.com 这样的网站
配置虚拟主机的步骤:
(1)启用 httpd-vhosts.conf
在 httpd.conf 中
# Virtual hosts,虚拟主机
Include conf/extra/httpd-vhosts.conf
(2)在httpd-vhosts.conf文件中做配置
#配置我们自己的虚拟主机
<VirtualHost 127.0.0.1:80>
DocumentRoot "e:/codes"
#这里配置欢迎首页面
DirectoryIndex my.html index.html index.htm index.php
<Directory />
Options FollowSymLinks
#不允许别人修改我们的页面
AllowOverride None
#舍子访问权限
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
(3)修改 hosts 文件
详细的访问网页的流程(php / jsp / asp / asp.net)
(4)测试