打開conf/httpd.conf
一、修改ServerName
ServerName localhost
二瘩将、修改DocumentRoot
DocumentRoot "D:/Apache24/htdocs"
<Directory "D:/Apache24/htdocs">
重啟Apache后
瀏覽器打開 localhost
三、增加其他兩個網(wǎng)站
在D:/Apache24目錄下創(chuàng)建兩個目錄myweb1凹耙、myweb2
分別增加index.html
內(nèi)容
增加如下代碼
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后
打開網(wǎng)址 localhost:81和localhost:82