Differences between revisions 2 and 5 (spanning 3 versions)
Revision 2 as of 2009-08-10 08:19:01
Size: 391
Editor: SamatJain
Comment:
Revision 5 as of 2013-07-27 03:33:59
Size: 1324
Editor: SamatJain
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
{{{#!highlight apacheconf {{{#!highlight apacheconf numbers=off
Line 13: Line 13:

== Cached Reverse Proxy ==

Use Apache's mod_disk to cache all requests made to a reverse proxy. For example, to setup a mirror to mirrors.kernel.org:

{{{#!highlight apacheconf numbers=off
# Configure mod_disk_cache (usually in /etc/apache/mods-enabled.d/disk_cache.conf)
<IfModule mod_disk_cache.c>
  CacheRoot /path/to/cache
</IfModule>

# Configure reverse proxy
<VirtualHost 72.36.165.250:80>
  ServerName proxied-site.samat.org

  CacheEnable disk /

  ProxyPass / http://mirrors.kernel.org/
  ProxyPassReverse / http://mirrors.kernel.org/
</VirtualHost>
}}}

== Apache logging ==

{{{#!highlight sh
# access.log should be vhost_combined by default
sed -i 's/other_vhosts_access/access/g' /etc/apache2/conf.d/other-vhosts-access-log

# Remove logging
sed -i '/^\s*ErrorLog/d' /etc/apache2/sites-available/default
sed -i '/^\s*CustomLog/d' /etc/apache2/sites-available/default
}}}

Reverse Proxy for a Subdomain

The below Apache reverse proxy configuration lets another website be served through a domain. The example is a little contrived.

<VirtualHost 72.36.165.250:80>
  ServerName proxied-site.samat.org

  ProxyPass / http://google.com/
  ProxyPassReverse / http://google.com/
</VirtualHost>

Cached Reverse Proxy

Use Apache's mod_disk to cache all requests made to a reverse proxy. For example, to setup a mirror to mirrors.kernel.org:

# Configure mod_disk_cache (usually in /etc/apache/mods-enabled.d/disk_cache.conf)
<IfModule mod_disk_cache.c>
  CacheRoot /path/to/cache
</IfModule>

# Configure reverse proxy
<VirtualHost 72.36.165.250:80>
  ServerName proxied-site.samat.org

  CacheEnable disk /

  ProxyPass / http://mirrors.kernel.org/
  ProxyPassReverse / http://mirrors.kernel.org/
</VirtualHost>

Apache logging

   1 # access.log should be vhost_combined by default
   2 sed -i 's/other_vhosts_access/access/g' /etc/apache2/conf.d/other-vhosts-access-log
   3 
   4 # Remove logging
   5 sed -i '/^\s*ErrorLog/d' /etc/apache2/sites-available/default
   6 sed -i '/^\s*CustomLog/d' /etc/apache2/sites-available/default


CategoryCheatSheet

SamatsWiki: CheatSheet/Apache (last edited 2013-07-27 03:33:59 by SamatJain)