apache vhost 範例

網路與網站相關議題和知識
回覆文章
dtchang
Site Admin
文章: 91
註冊時間: 2017-01-22, 16:54

apache vhost 範例

文章 dtchang » 2018-09-10, 11:39

C:\Apache24\conf\httpd.conf 設定

代碼: 選擇全部

# Virtual hosts
Include conf/extra/httpd-vhosts.conf
-----------------
C:\Apache24\conf\extra\httpd-vhosts.conf

代碼: 選擇全部

# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<Directory "D:/Inetpub/ocs">
    Options FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
	DirectoryIndex index.html index.htm index.php
</Directory>

<Directory "D:/Inetpub/wwwroot">
    Options Indexes FollowSymLinks Includes
    AllowOverride All
    Require all granted
</Directory>	

<VirtualHost *:80>
    ServerAdmin dtchang@chu.edu.tw
    DocumentRoot "D:/Inetpub/wwwroot"
    ServerName sun.im.chu.edu.tw
    ServerAlias sun.im.chu.edu.tw
	Alias /ocs/ "D:/Inetpub/ocs/"	
    ErrorLog "logs/sun.im.chu.edu.tw.log"
#	CustomLog "logs/sun.im.chu.edu.tw_log.log" common
    CustomLog "|bin/rotatelogs.exe -l logs/sun_im_access.%Y.%m.%d.log 10M" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin dtchang@chu.edu.tw
    DocumentRoot "D:/Inetpub/chuexten/web"
    ServerName iu.adm.chu.edu.tw
    ServerAlias iu.adm.chu.edu.tw
    ErrorLog "D:/Inetpub/chuexten/logs/iu.adm.chu.edu.tw_error.log"
   CustomLog "D:/Inetpub/chuexten/logs/iu.adm.chu.edu.tw_log.log" common
#  CustomLog "|bin/rotatelogs.exe -l D:/Inetpub/chuexten/logs/iu_adm_access.%Y.%m.%d.log 10M" common	
<Directory "D:/Inetpub/chuexten/web">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>	
</VirtualHost>


回覆文章