windows下apache配置虛擬機器主機

來源:互聯網
上載者:User

標籤:分享   apache   虛擬   root   etc   dir   xxx   win   ges   

因為有多個laravel項目需要配置根目錄到public下面,所以要配置多個虛擬機器主機

 

方法一:添加連接埠號碼

  • 第一步:進入apache的目錄 Apache24\conf 找到 httpd.conf 檔案,在 Listen 80 下方加上 Listen 81

  

  • 第二步:進入httpd.conf檔案的同級目錄  Apache24\conf\extra 找到 httpd-vhosts.conf 檔案,在檔案最後加上

 

<VirtualHost *:81>    DocumentRoot "E:\PHP\exam\public"  把路徑改為自己的</VirtualHost>

 

  • 第三步:重啟apache後,在瀏覽器中直接存取 localhost:81 就可以了

 

方法二:添加主機名稱

  • 第一步:進入目錄 C:\Windows\System32\drivers\etc 找到 hosts 檔案,在檔案最後添加上 127.0.0.1     XXXX (名稱改為自己的)

  

  • 第二步:進入apache的目錄 Apache24\conf\extra 找到 httpd-vhosts.conf 檔案,在檔案最後加上
<VirtualHost *:80>    ServerName exam.cn               名稱改為自己的    DocumentRoot E:/PHP/exam/public      路徑改為自己的    <Directory  "E:/PHP">        Options +Indexes +Includes +FollowSymLinks +MultiViews        AllowOverride All        Require local    </Directory></VirtualHost>
  • 第三步:重啟apache後,在瀏覽器中直接存取 exam.cn 就可以了

windows下apache配置虛擬機器主機

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.