2015年5月26日 星期二

apache 虛擬目錄設定

系統:
Win 7 ( XAMPP )

程式路徑: E:\www\project_name
phpmyadmin路徑: C:\xampp\phpMyAdmin

目的:
http://localhost  訪問該程式
http://localhost/phpmyadmin 訪問phpmyadmin

解法:
使用Alias ( 我是加在vhost中 )
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "E:\www\project_name"
    ServerName localhost
    ErrorLog "logs/localhost-error.log"
    CustomLog "logs/localhost-access.log" common
    Alias /phpmyadmin C:\xampp\phpMyAdmin
    <Directory "E:\www\project_name">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

參考資料:
http://stackoverflow.com/questions/5552081/using-a-directory-in-virtualhost-servername

(vhost)解決403 Access Forbidden 錯誤
https://superuser.com/a/714183
Directory 裡面新增 Require all granted
<VirtualHost *:80>
    ServerAdmin webmaster@test.example.com
    DocumentRoot "C:\test"
    ServerName test.example.com
    ErrorLog "logs/test.example.com-error.log"
    CustomLog "logs/test.example.com-access.log" common
    <Directory "C:\test">
        Require all granted
    </Directory>
</VirtualHost>








沒有留言:

張貼留言