Apache

From Supernifty
Jump to: navigation, search

Performance

Cache Control

  • Enable mod_expires
  • Edit .htaccess
ExpiresActive On
ExpiresDefault "access plus 1 month"

or

ExpiresByType image/gif "access plus 1 month"

Image Compression

  • pngcrush
  • gifsicle
  • jpegtran

Access

Edit .htpasswd

htpasswd .htpasswd username

to create the file

htpasswd -c .htpasswd username

Edit .htaccess

AuthUserFile /home/user/.htpasswd
AuthGroupFile /dev/null
AuthName "Protected Resource"
AuthType Basic
<Limit GET POST>
  require valid-user
</Limit>

Putting behind lighttpd proxy

Ubuntu

apt-get install lighttpd

Move Apache

  • Edit site-enabled for namedvirtualhost to be port 81
  • Disable ssl
  • Edit ports.conf to use port 81
  • Disable ssl

Redirect lighttpd

proxy.server = ( "" =>
 ( ( "host" => "127.0.0.1", "port" => 81) )
)