apache2反向代理

在DEBIAN下使用apache2的反向代理,连接到一台内部服务器上。
首先要激活proxy模块:
sudo a2enmod
选择proxy
sudo mkdir /var/www/proxy
sudo chown www-data:www-data /var/www/proxy
然后修改对应的sites:

<VirtualHost *>
ServerAdmin xxx@xxx.org
ServerName xxxxx
ProxyRequests Off
<Proxy *>
Order allow,deny
Allow from all
</Proxy>
# reverse proxy setting
ProxyPass / http://192.168.100.8:8180/
ProxyPassReverse / http://192.168.100.8:8180/
# cache dir root
CacheRoot "/var/www/proxy"
# max cache storage
CacheSize 50000000
# hour: every 4 hour
CacheGcInterval 4
# max page expire time: hour
CacheMaxExpire 240
# Expire time = (now - last_modified) * CacheLastModifiedFactor
CacheLastModifiedFactor 0.1
# defalt expire tag: hour
CacheDefaultExpire 1
# force complete after precent of content retrived: 60-90%
CacheForceCompletion 80

ErrorLog /var/log/apache2/error-westdc.geodata.cn.log
CustomLog /var/log/apache2/access-westdc.geodata.cn.log combined
ServerSignature On

</VirtualHost>

参考: http://www.chedong.com/tech/cache.html

This entry was posted in Linux and tagged , , . Bookmark the permalink.

2 Responses to apache2反向代理

  1. wlx [微博 ] says:

    关键是要激活proxy_http模块。
    不知道cache模块是否必须。

  2. wlx [微博 ] says:

    cache模块可以去掉。

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please copy the string Si6kH5 to the field below:

以新浪微博帐号登录