配置虛擬網域名稱,避免冗長的路徑,順便把index.php也隱藏掉,這裡我用的是thinkphp框架。
1. vim /etc/hosts , 把虛擬網域名稱新增進去。例如我這裡最簡單的用tp5.com 代替。那就加上一行
127.0.0.1 tp5.com
2.在/etc/apache2/apache2.conf 中進行virtualhost的設定
servername tp5.com
documentroot /var/www/html/
options indexes followsymlinks
allowoverride all
require all granted
servername 是對應著hosts檔案中配置的虛擬網域名稱
documentroot 是web伺服器的根目錄的絕對路徑
是專案的路徑,同時也是index.php 放置的位置
3.效果如圖所示
PHP的虛擬網域名稱的配置
第一步 開啟apace的安裝檔案的所在地,到conf目錄下找到htpd.conf,並雙擊開啟。將516行前的 號去掉 第二步 開啟windows資料夾下面的system32下的drivers下面的etc資料夾,在etc檔案下雙擊開啟hosts 我在電腦裡面的檔案位置c windows system3...
PHP 配置虛擬網域名稱訪問
本內容分以下幾個步驟 1 首頁我們得找到host檔案 這個檔案在c盤中 windows system32 drivers etc hosts 在該檔案中插入 php view plain copy print?localhost name resolution is handled within d...
php學習 本地配置虛擬網域名稱
整合環境phpstudy apache php5.4 apache配置虛擬網域名稱首先是在httpd conf裡注釋掉 開啟vhost conf serveradmin admin phpstudy.net documentroot 根目錄 servername 網域名稱 options index...