httpd-vhosts.conf配置文件理解


# Virtual Hosts
#
# 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
#
# 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


#
# 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 block.

#基于ip和端口的配置

#########port base ip  


#邮箱地址

    ServerAdmin [email protected]  

#web服务器文件的存档位置

    DocumentRoot "/var/blog"

#服务器名

    ServerName 192.168.1.103

#服务器别名

    ServerAlias www.etiantian.org

#错误日志文件存放位置

    ErrorLog "logs/blog-error_log"
   # CustomLog "logs/blog-access_log" common
   CustomLog "|/usr/local/sbin/cronolog /app/logs/access_www_%Y%m%d.log" combined


    ServerAdmin [email protected]
    DocumentRoot "/var/blog"
    ServerName 192.168.1.111
    ServerAlias www.xiaomi.com
    ErrorLog "logs/blog-error_log"
   # CustomLog "logs/blog-access_log" common
   CustomLog "|/usr/local/sbin/cronolog /app/logs/access_www_%Y%m%d.log" combined

######base name基于域名的虚拟主机的配置

    ServerAdmin [email protected]
    DocumentRoot "/var/blog"
    ServerName www.xiaomi.com
    ServerAlias xiaomi.com
    ErrorLog "logs/blog-error_log"
   # CustomLog "logs/blog-access_log" common

   CustomLog "|/usr/local/sbin/cronolog /app/logs/access_www_%Y%m%d.log" combined

#开启缓存插件

 ExpiresActive on  

#以下是缓存策略

 ExpiresDefault "access plus 12 months"
 ExpiresByType text/html "access plus 12 months" 
 ExpiresByType text/css "access plus 12 months"
 ExpiresByType image/gif "access plus 12 months"
 ExpiresByType image/jpeg "access plus 12 months"
 ExpiresByType image/jpg "access plus 12 months"
 ExpiresByType image/png "access plus 12 months"
 ExpiresByType application/x-shockwave-flash "access plus 12 months"
 ExpiresByType application/x-javascript "access plus 12 months"
 ExpiresByType video/x-flv "access plus 12 months"

 

#指压缩程度的等级,级别从一到九,最高级别为九,这样做可以减少八成大小的传输量

 DeflateCompressionLevel 9
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/plain text/xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/css







    ServerAdmin [email protected]
    DocumentRoot "/var/blog"
    ServerName www.etiantian.org
    ServerAlias www.etiantian.org
    ErrorLog "logs/blog-error_log"
   # CustomLog "logs/blog-access_log" common
   CustomLog "|/usr/local/sbin/cronolog /app/logs/access_www_%Y%m%d.log" combined

转载地址:http://www.chengxuyuans.com/Linux/91410.html

你可能感兴趣的:(httpd-vhosts.conf配置文件理解)