虛擬機器主機apache

來源:互聯網
上載者:User

標籤:blog   http   io   ar   os   使用   sp   strong   檔案   

1、虛擬機器主機配置

windows:

1)載入配置虛擬機器主機的設定檔,在Apache/conf中找到httpd.conf檔案,並搜尋出以下的兩句話,將Include conf/extra/httpd-vhosts.conf前的#去掉;

# Various default settings
#Include conf/extra/httpd-default.conf

2)編輯虛擬機器主機的設定檔,在Apache/conf/extra中找到httpd-vhosts.conf檔案,將檔案的已有內容全部加上注釋#號,然後自行編輯檔案,內容差不多如下:

#
# Use name-based virtual hosting.
# 這裡的意思是,本伺服器使用的是基於主機名稱的虛擬機器主機;還有一種基於# IP的虛擬機器主機,不過我還沒研究過
#
NameVirtualHost *:80

# "D:working/http"為Apache配置時,DirectoryRoot的路徑,要配置# 虛擬機器主機,必須先為預設的路徑配置虛擬機器主機,不然配置不成功
<VirtualHost *:80>
ServerName localhost
DocumentRoot "D:/working/http"
</VirtualHost>
# 192.168.1.107是我的PC的ip地址,ServerName還可以設定為任意網域名稱(只要DNS伺服器能夠解析到你的電腦上就可以),你也可以自己在C:\Windows\System32\drivers\etc\host檔案上加上一個網域名稱解析的項,那麼你的電腦也可以將網域名稱解析為你自己的機器,不過其他電腦就無法通過則個網域名稱訪問你的伺服器了
<VirtualHost *:80>
ServerName 192.168.1.107
DocumentRoot "D:/working/http/Project1"
</VirtualHost>

3) 這個時候,你就可以開啟瀏覽器分別輸入http://localhost  http://192.168.1.107看看訪問的都是什麼網頁。

虛擬機器主機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.