步驟1: 配置虛擬目錄在 apache 的 conf 目錄下 httpd.conf 的 <IfModule dir_module>節(jié)點(diǎn)后添加如下代碼
<IfModule dir_module>
#相當(dāng)于歡迎頁(yè)面
DirectoryIndex index.html index.htm index.php
#你站點(diǎn)的別名
Alias /myblog “D:/myblog”
<Directory d:/myblog>
#這是訪問(wèn)權(quán)限設(shè)置
Order allow,deny
Allow from all
<Directory>
</IfModule>
步驟2: 注銷 DocumentRoot 根目錄
步驟3: 重啟apache
步驟1: 啟用 httpd-vhosts.conf 虛擬主機(jī) 在 httpd.conf 文件中搜索 vhost
步驟2: 在 httpd-vhosts.conf 做配置
<VirtualHost 127.0.0.1:80>
DocumentRoot “d:/myblog”
#這里配置歡迎頁(yè)面
DirectoryIndex index.html index.htm index.php
<Directory />
Options FollowSymLinks
#不允許別人修改我們的頁(yè)面
AllowOverride None
#設(shè)置訪問(wèn)權(quán)限
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
步驟3: 修改 hosts 文件 重啟 apache
更多建議: