打开conf/httpd.conf

一、修改ServerName
ServerName localhost

二、修改DocumentRoot
DocumentRoot "D:/Apache24/htdocs"
<Directory "D:/Apache24/htdocs">

重启Apache后

浏览器打开 localhost

三、增加其他两个网站
在D:/Apache24目录下创建两个目录myweb1、myweb2
分别增加index.html

内容


增加如下代码
Listen 81
<VirtualHost *:81>
ServerName 127.0.0.1
DocumentRoot "D:/Apache24/myweb1"
<Directory "D:/Apache24/myweb1">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
Listen 82
<VirtualHost *:82>
ServerName 127.0.0.1
DocumentRoot "D:/Apache24/myweb2"
<Directory "D:/Apache24/myweb2">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>

重启Apache后

打开网址 localhost:81和localhost:82


网友评论