apache php 配置虛擬目錄

採用了Wampserver安裝了php的運行環境,而且安裝在c盤目錄下。可是我想把項目放在e盤,而且配置好虛擬目錄。php

  1. 修改httpd.conf(個人是在C:\wamp\bin\apache\apache2.4.17\conf目錄中),

1)directory改爲下面的apache

<Directory />瀏覽器

    Options Indexeside

    AllowOverride Noneserver

    Order allow,denyget

    Allow from allio

</Directory>配置

 

2)在Listen 0.0.0.0:8080(個人監聽端口是8080,不是默認的80)下面新增一條記錄List

Listen 0.0.0.0:8081(監聽8081端口)error

#Include conf/extra/httpd-vhosts.conf 去掉前面的#。

  1. 在C:\wamp\bin\apache\apache2.4.17\conf\extra目錄下找到httpd-vhosts.conf文件,

打開添加

<VirtualHost *:8081>

    DocumentRoot "E:/php/xxxt" 

    ServerName myvirtualhost.com 

    ErrorLog "logs/myvirtualhost.com-error.log" 

    CustomLog "logs/myvirtualhost.com-access.log" common 

</VirtualHost>

其中E:/php/xxxt的路徑必須是全英文的,不能有中文漢字,不然在訪問的時候會報錯。

 

3.重啓Apache,在瀏覽器中訪問http://localhost:8081/index.php就能夠了。

相關文章
相關標籤/搜索