Mac配置PHP虛擬主機

2021-09-20 10:28:47 字數 1271 閱讀 2201

一、啟動apache

終端輸入:sudo apachectl start

apache的安裝目錄在:/etc/apache2/,etc預設是隱藏的。有三種方式檢視: 

1.桌面位於finder時:shift+command+g,輸入「/etc」(即finder-前往-前往資料夾的快捷鍵)

2.開啟終端:cd /etc

3.可以在terminal 輸入 "open /etc"

二、設定虛擬主機

1.在終端執行「sudo vi /etc/apache2/httpd.conf」,開啟apche的配置檔案 

2.在httpd.conf中找到「#include /private/etc/apache2/extra/httpd-vhosts.conf」,去掉前面的「#」,儲存並退出。 

3.執行「sudo apachectl restart」,重啟apache後就開啟了虛擬主機配置功能。 

4.執行「sudo vi /etc/apache2/extra/httpd-vhosts.conf」,就開啟了配置虛擬主機檔案httpd-vhost.conf,配置虛擬主機了。需要注意的是該檔案預設開啟了兩個作為例子的虛擬主機

三、**

serveradmin [email protected]

documentroot "/usr/docs/dummy-host.example.com"

servername dummy-host.example.com

errorlog "/private/var/log/apache2/dummy-host.example.com-error_log"

customlog "/private/var/log/apache2/dummy-host.example.com-access_log" common

serveradmin [email protected]

documentroot "/usr/docs/dummy-host2.example.com"

servername dummy-host2.example.com

errorlog "/private/var/log/apache2/dummy-host2.example.com-error_log"

customlog "/private/var/log/apache2/dummy-host2.example.com-access_log" common

Mac配置虛擬主機

一 啟動apache 終端輸入 sudo apachectl start apache的安裝目錄在 etc apache2 etc預設是隱藏的。有三種方式檢視 1.桌面位於finder時 shift command g,輸入 etc 即finder 前往 前往資料夾的快捷鍵 2.開啟終端 cd et...

Mac配置虛擬主機

一 啟動apache 終端輸入 sudo apachectl start apache的安裝目錄在 etc apache2 etc預設是隱藏的。有三種方式檢視 1.桌面位於finder時 shift command g,輸入 etc 即finder 前往 前往資料夾的快捷鍵 2.開啟終端 cd et...

PHP 虛擬主機配置

wamp 環境下 1.首先建vhost 資料夾,資料夾裡面建檔案leshowtest.conf vhost 檔案位置 圖一 leshowtest.conf 檔案裡面配置 documentroot e wamp www ttmv dev home servername live.ttmv.com se...