打开conf/httpd.conf
image.png
一、修改ServerName
ServerName localhost
image.png
二、修改DocumentRoot
DocumentRoot "D:/Apache24/htdocs"
<Directory "D:/Apache24/htdocs">
image.png
重启Apache后
image.png
浏览器打开 localhost
image.png三、增加其他两个网站
在D:/Apache24目录下创建两个目录myweb1、myweb2
分别增加index.html
image.png
内容
image.png image.png
增加如下代码
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后
image.png
打开网址 localhost:81和localhost:82
image.png image.png
网友评论