因為 Apache 的 Virtual Host 預設必須要放在 DocumentRoot 的目錄底下,否則會出現 client denied by server configuration
必須在 Virtual Host 的 conf 加上以下幾行
Apache 2.2 版
<Directory /{your_path}> #... Order allow,deny Allow from all </Directory>
因為 Apache 的 Virtual Host 預設必須要放在 DocumentRoot 的目錄底下,否則會出現 client denied by server configuration
必須在 Virtual Host 的 conf 加上以下幾行
Apache 2.2 版
<Directory /{your_path}> #... Order allow,deny Allow from all </Directory>
在 AWS EC2 裝好基本的 LAMP 環境之後,想設一下 Apache Virtual Host 設定
結果居然無法運作,查了一下才發現在 Apache 2.4.6 (或更之前) 有對這部份的設定做了一些調整
以下是簡易的筆記
1. NameVirtualHost*:80
這行已經廢除,不用再寫了
請參考:http://linux.vbird.org/linux_server/0360apache.php#www_basic_basic
--
使用情境
假設我要在 http://localhost/phpMyAdmin 裡放 phpMyAdmin 的服務
但 phpMyAdmin 目錄我想不放在我網站的目錄,那麼可以這樣設定
1. 修改 httpd.conf,新增 Listen
在原本 Listen 80 後加上想要使用的 Port
Listen 8012
2. 修改 httpd-vhosts.conf,加上想要的站
1. 修改 hosts
路徑 C:\Windows\System32\drivers\etc\hosts,加上
127.0.0.1 test.local
2. 修改 httpd-vhosts.conf
查了好久才發現,原來 appserv 安裝的 apache 預設是把 rewrite_module 註解掉的
所以把底下這行解除註解就可以了
LoadModule rewrite_module modules/mod_rewrite.so