Wamp virtual host 設定方式

2017-03-18
先到wamp的conf資料夾下尋找httpd.conf檔案
{安裝路徑}wampinApache#.#.#confhttpd.conf

Screenshot of the Apache configuration file in WAMP

尋找 LoadModule vhost_alias_module 並把前面的#刪掉
這個就是在啟用apache模組的動作

Screenshot of the vhost_alias_module directive in the Apache  configuration


因為vhost的設定文件是include在外部的文件,所以我們也要去把引用這個設定值的外部文件給打開
尋找 Include conf/extra/httpd-vhosts.conf 然後移除前面的#

Screenshot of the include virtual hosts directive in the Apache configuration file

到這裡我們已經將apache的vhost功能給啟動了,我們接下來就是要設置我們的vhost
到以下路徑尋找設定文件
{安裝路徑}wampinApache#.#.#confextrahttpd-vhosts.conf

Screenshot of the Apache virtual hosts configuration file in WAMP

這個文件的上方有說明如何設置,下圖為vhost設置的內容範例

Screenshot of a virtual host being added to Apache

下來這個步驟是設定DNS指向用的,如果你是有其他的DNS主機就在上面做設定即可,這裡的設置是針對自指的設置
到以下目錄開啟系統的hosts檔案,複製到桌面才可以做編輯,編輯好再丟回去取代原本的檔案就好
WindowsSystem32driversetchosts

Screenshot of the Windows hosts file

打開hosts檔案然後把本機ip自指到您剛剛vhost所設定的DNS

Screenshot of a new host being added to the Windows hosts file

到這裡已經完成了DNS設置的全部工作,重新啟動wamp就可以了

Screenshot of the WAMP menu option to restart all services

原文及圖片來源: https://john-dugan.com/wamp-vhost-setup/

Contact

Github

Codepen

歡迎參觀我的賣場
© 2013 Copyright Digishot Web | Design Tools
Visitors【622391】
digishot webdesign studio