mac下apache的多網站配置

來源:互聯網
上載者:User

標籤:http   ar   os   sp   on   檔案   art   bs   代碼   

以下操作均建立在    已經配置好了php環境

  從網上搜尋了下,後來自己配置了下還是比較簡單的!

  我的環境目錄是在/Library/webServer/Documents

      測試的時候可以直接在這裡建立一個檔案夾,裡面寫一個index.php  隨便輸出個什麼

      在Finder中ctrl+shift+g  輸入/private/etc   進入找到apache2   -》   找到httpd.conf   開啟

  

  #Virtual hosts
  Include /private/etc/apache2/extra/httpd-vhosts.conf  

     尋找這行代碼,去 掉 include 前面的#

     下一步:

        apache2/extra/httpd-vhosts.conf

    

  <VirtualHost *:80>
    DocumentRoot "/Library/WebServer/Documents/zend/test"
    ServerName www.test.com
  </VirtualHost>

 

照葫蘆畫瓢添加如上代碼。目錄換成自己的項目 目錄!   serverName 就是你要用的訪問項目的網域名稱,自己隨便起

下一步:

   在/private/etc    目錄下面找到   hosts   這個檔案,開啟      添加上指向   127.0.0.1 www.test.com  這些個地方最好是複製,不要自己手敲!~免的出錯!弄的自己心煩!

 

配置完畢 之後去開啟終端,輸入  sudo apachectl restart  或者  sudo apachectl stop 之後 sudo apachectl start 

      

mac下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.