虚拟主机配置

<VirtualHost *:80>
    DocumentRoot "/tmp/tmp"
    ServerName tmp.com
<Directory /tmp/tmp/>
      Order allow,deny
      Deny from all
</Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/data/www"
    ServerName www.1.com
    ServerAlias www.a.com  www.b.com
    ServerAlias www.c.com
# 用户认证
#    <Directory /data/www>
#       AllowOverride AuthConfig
#       AuthName "alksdjflkasjdf"
#       AuthType Basic
#       AuthUserFile /data/.htpasswd
#       require valid-user
#    </Directory>
# 域名跳转
    <IfModule mod_rewrite.c>
        RewriteEngine on
#        RewriteCond %{HTTP_HOST} ^www.a.com$ [OR]
        RewriteCond %{HTTP_HOST} !^www.1.com$
        RewriteRule ^/(.*)$ http://www.1.com/$1 [R=301,L]
        RewriteRule ^/(.*)\.png$ /static/image/common/fav.gif [R=302]
#RewriteRule ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /forum.php?mod=viewthread&tid=$1&extra=page%3D$2
RewriteRule ^/topic-(.+)\.html$ /portal.php?mod=topic&topic=$1&%1
RewriteRule ^/article-([0-9]+)-([0-9]+)\.html$ /portal.php?mod=view&aid=$1&page=$2&%1
RewriteRule ^/forum-(\w+)-([0-9]+)\.html$ /forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteRule ^/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteRule ^/group-([0-9]+)-([0-9]+)\.html$ /forum.php?mod=group&fid=$1&page=$2&%1
RewriteRule ^/space-(username|uid)-(.+)\.html$ /home.php?mod=space&$1=$2&%1
RewriteRule ^/blog-([0-9]+)-([0-9]+)\.html$ /home.php?mod=space&uid=$1&do=blog&id=$2&%1
RewriteRule ^/archiver/(fid|tid)-([0-9]+)\.html$ /archiver/index.php?action=$1&value=$2&%1
RewriteRule ^/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ /plugin.php?id=$1:$2&%1
RewriteCond %{HTTP_USER_AGENT}  ^.*Firefox/4.0* [NC,OR]
RewriteCond %{HTTP_USER_AGENT}  ^.*curl* [NC]
RewriteRule  .*  -  [F]
    </IfModule>
# 配置日志
    ErrorLog "/usr/local/apache2/logs/dummy-host.example.com-error_log"
    SetEnvIf Request_URI ".*\.gif$" image-request
    SetEnvIf Request_URI ".*\.jpg$" image-request
    SetEnvIf Request_URI ".*\.png$" image-request
    SetEnvIf Request_URI ".*\.bmp$" image-request
    SetEnvIf Request_URI ".*\.swf$" image-request
    SetEnvIf Request_URI ".*\.js$" image-request
    SetEnvIf Request_URI ".*\.css$" image-request
    CustomLog "|/usr/local/apache2/bin/rotatelogs -l /usr/local/apache2/logs/1.com-access__%Y%m%d.log 86400" combined env=!image-request
# 配置静态文件缓存
#<IfModule mod_expires.c>
#    ExpiresActive on
#    ExpiresByType image/gif  "access plus 1 days"
#    ExpiresByType image/jpeg "access plus 24 hours"
#    ExpiresByType image/png "access plus 24 hours"
#    ExpiresByType text/css "now plus 2 hour"
#    ExpiresByType application/x-javascript "now plus 2 hours"
#    ExpiresByType application/javascript "now plus 2 hours"
#    ExpiresByType application/x-shockwave-flash "now plus 2 hours"
#    ExpiresDefault "now plus 0 min"
#</IfModule>

<Ifmodule mod_headers.c>
<filesmatch "\.(html|htm|txt)$">
header set cache-control "max-age=3600"
</filesmatch>
<filesmatch "\.(css|js|swf)$">
header set cache-control "max-age=604800"
</filesmatch>
<filesmatch "\.(ico|gif|jpg|jpeg|png|flv|pdf)$">
header set cache-control "max-age=29030400"
</filesmatch>
</ifmodule>

# 配置防盗链
<Directory /data/www/>
SetEnvIfNoCase Referer "^http://www.1.com" local_ref
SetEnvIfNoCase Referer "www.a.com" local_ref
SetEnvIfNoCase Referer "www.b.com" local_ref
SetEnvIfNoCase Referer "^$" local_ref
<filesmatch "\.(txt|doc|mp3|zip|rar|jpg|gif)">
Order Allow,Deny
Allow from env=local_ref
</filesmatch>
</Directory>
# 访问控制
#<Directory /data/www/admin>
#<filesmatch ".*">
#      Order deny,allow
#      Deny from all
#      Allow from 127.0.0.1
#</filesmatch>
#</Directory>
#<Directory /data/www>
#<Filesmatch  "^admin.php(.*)$">
#      Order deny,allow
#      Deny from all
#      Allow from 127.0.0.1
#</Filesmatch>
#</Directory>
<Directory /data/www/uc_server>
    php_admin_flag engine off
    <filesmatch "(.*)php">
            Order deny,allow
            Deny from all
    </filesmatch>
</Directory>



</VirtualHost>


你可能感兴趣的:(用户,认证,虚拟主机,require)