wamp下Apache配置vhost


1、由於后面虛擬機中需要用到Rewrite所以先編輯Apache的conf目錄下的httpd.conf文件。(我的文件位置是:D:\Program Files\wamp\bin\apache\apache2.4.9\conf\httpd.conf)

  a. 添加mod_rewrite.so模塊支持。去掉下列行中前面的#號。

      LoadModule rewrite_module modules/mod_rewrite.so

  b.配置apache支持虛擬機,去掉#Include conf/extra/httpd-vhosts.conf前的#。

      # Virtual hosts Include conf/extra/httpd-vhosts.conf

  c.找到Directory,修改里面的內容為:

    <Directory />
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

 

2、編輯conf目錄下extra文件夾下的httpd-vhosts.conf。

  在文件最下面添加新有配置,配置文件如下:

  <VirtualHost *:80> 

    #管理員郵箱
     ServerAdmin webmaster@dummy-host2.example.com

    #項目根目錄
      DocumentRoot "E:/www/wyc"

    #域名
      ServerName wyc.com

    #別名,可根據實際需要添加                         

    ServerAlias wyc.com

    #錯誤日志路徑,可根據實際需要添加

      ErrorLog "logs/test.t.sins.com.cn-error.log"    

    CustomLog "logs/test.t.sins.com.cn-access.log" common    

    RewriteEngine on

        #重寫規則,可根據實際需要添加    

    RewriteRule  ^/(.*)$       /apps/index.php [L]
  </VirtualHost>

 

3.到c盤hosts文件下添加域名

  127.0.0.1       wyc.com

 

4.重啟wampserver


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM