2009-08-10

Apache VirtuslHost 偵聽不同埠

環境 Apache 2.2

先在 httpd.conf 設定:

→ Listen 8080

→ Include conf/extra/httpd-vhosts.conf



接著在 conf/extra/httpd-vhosts.conf 設定:

→ NameVirtualHost localhost:8080

→ <VirtualHost localhost:8080>

→ DocumentRoot "C:/wamp/www/web8080"

→ ServerName localhost

→ ErrorLog "logs/web8080-error.log"

→ CustomLog "logs/web8080-access.log" common

→ </VirtualHost>



若要在本機上能 access 到某個 host,需要在C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS 加入一筆記錄


設定別名的方式

Alias /travel_festival/ "C:/Users/shinder/Documents/My Dropbox/current_proj/travel_festival/"

 <Directory "C:/Users/shinder/Documents/My Dropbox/current_proj/travel_festival/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order allow,deny
    Allow from all
 </Directory>


另一種做法 ------------------------------------

<Directory "D:/shinder/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        Order allow,deny
        Allow from all
</Directory>

Listen 20100
<VirtualHost localhost:20100>
        DocumentRoot "D:/shinder"
        ServerName localhost
        ErrorLog "logs/shinder-error.log"
        CustomLog "logs/shinder-access.log" common
</VirtualHost>



沒有留言:

FB 留言