一段apache虚拟主机的配置代码

一段apache虚拟主机的配置代码,包括了对部分目录禁用php解析,apache日志目录等

### Section 3: Virtual Hosts
#
# VirtualHost: 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.2/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.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html/defsite
#    ServerName unknown-host.example.com
ErrorLog logs/defsite-host.example.com-error_log
CustomLog logs/defsit-host.example.com-access_log common

#    <IfModule mod_php5.c>
#        php_admin_value open_basedir "/var/www/html/vhosts/testsite/html/:/tmp"
#    </IfModule>
#
#    <IfModule suexec.c>
#        SuexecUserGroup web_testsite web_testsite
#    </IfModule>
</VirtualHost>

<VirtualHost *:80>
ServerAdmin tech@mysite.com
DocumentRoot "/var/www/html/vhosts/testsite/html"
ServerName www.testsite.com
ServerAlias job.mysite.com
ErrorLog "logs/testsite-error.log"
CustomLog "logs/testsite-access.log" common
<IfModule mod_php5.c>
php_admin_value open_basedir "/var/www/html/vhosts/testsite/html/:/tmp"
</IfModule>
RewriteLog "/var/www/html/vhosts/testsite/log/rewritelog.log"
</VirtualHost>
<Directory "/var/www/html/vhosts/testsite/html">
AllowOverride All
Options FollowSymLinks
Order allow,deny
Allow from all

#AllowOverride AuthConfig  #this line and below is required to auth,
#  AllowOverride has been configured above, no need to re configure
#    AuthName web_testsite
#    AuthType Basic
#    AuthUserFile /var/www/htpasswd/testsite.htpasswd
#    require valid-user
</Directory>
<Directory "/var/www/html/vhosts/testsite/html/images">
AllowOverride None
Options FollowSymLinks
Order allow,deny
php_admin_flag engine off
Allow from all
</Directory>
<Directory "/var/www/html/vhosts/testsite/html/css">
AllowOverride None
php_admin_flag engine off
</Directory>
<Directory "/var/www/html/vhosts/testsite/html/data">
AllowOverride None
php_admin_flag engine off
</Directory>
<Directory "/var/www/html/vhosts/testsite/html/js">
AllowOverride None
php_admin_flag engine off
</Directory>

<VirtualHost *:80>
ServerAdmin tech@mysite.com
DocumentRoot "/var/www/html/vhosts/www2.mysite.com/html"
ServerName www2.mysite.com
ServerAlias job2.mysite.com
ErrorLog "logs/www2.mysite.com-error.log"
CustomLog "logs/www2.mysite.com-access.log" common
</VirtualHost>
<Directory "/var/www/html/vhosts/www2.mysite.com/html">
AllowOverride All
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>

<VirtualHost *:80>
ServerAdmin tech@mysite.com
DocumentRoot "/var/www/html/vhosts/z.mysite.com/html"
ServerName z.mysite.com
ErrorLog "logs/z.mysite.com-error.log"
CustomLog "logs/z.mysite.com-access.log" common
</VirtualHost>
<Directory "/var/www/html/vhosts/z.mysite.com/html">
AllowOverride All
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>

<VirtualHost *:80>
ServerAdmin tech@mysite.com
DocumentRoot "/var/www/html/vhosts/bbs.mysite.net/html"
ServerName bbs.mysite.com
ErrorLog "logs/bbs.mysite.net-error.log"
CustomLog "logs/bbs.mysite.net-access.log" common
</VirtualHost>
<Directory "/var/www/html/vhosts/bbs.mysite.net/html">
AllowOverride All
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>

发表评论

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据