Apache反向代理,本地化访问

Apache反向代理的设置如下:


NameVirtualHost *:80

<VirtualHost *:80>

        ServerName www.test.com

        ServerAdmin webmaster@localhost

        ErrorLog /var/log/apache2/error.log

        LogLevel warn

        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""

        TransferLog "|/usr/sbin/rotatelogs /var/www/logs/db16.main 3600"


        ProxyRequests Off

       ProxyPass / http://www.test.com/

       ProxyPassReverse / http://www.test.com/


        ServerSignature On

        CacheRoot /var/cache/apache2/mod_disk_cache

        CacheEnable disk /

        CacheEnable disk http://www.test.com/

        CacheDirLevels 5

        CacheDirLength 3

        CacheMaxExpire 86400

        CacheLastModifiedFactor 0.1

        CacheDefaultExpire 2400



</VirtualHost>



本地下载Apache目录的设置:

NameVirtualHost *:8080

<VirtualHost *:8080>

        ServerName 192.168.98.106

        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/download/

        <Directory /var/www/download/>

                Options Indexes FollowSymLinks MultiViews

                AllowOverride All

                Order allow,deny

                allow from all

        </Directory>

        ServerSignature On

</VirtualHost>



<IfModule mod_proxy.c>

        <Proxy *>

                AddDefaultCharset off

                Order allow,deny

                allow from all

                #Allow from .example.com


                # Define the character set for proxied FTP directory listings

                ProxyFtpDirCharset UTF-8

        </Proxy>


        # Enable/disable the handling of HTTP/1.1 "Via:" headers.

        # ("Full" adds the server version; "Block" removes all outgoing Via: headers)

        # Set to one of: Off | On | Full | Block


        ProxyVia On

</IfModule>


cat /etc/apache2/mods-enabled/expires.conf

<IfModule mod_expires.c>

  ExpiresActive On

  ExpiresDefault "access plus 1 hours"

  ExpiresByType text/html "access plus 1 hours"

  ExpiresByType text/plain "access plus 1 hours"

  ExpiresByType image/gif "access plus 1 hours"

  ExpiresByType image/png "access plus 1 hours"

  ExpiresByType image/jpeg "access plus 1 hours"

  ExpiresByType image/x-icon "access plus 1 hours"

</IfModule>



你可能感兴趣的:(apache,反向代理)