Htaccess

From Null-pointer

Jump to: navigation, search

Contents

Allow htaccess files

<Directory "C:/devapps/Apache/Apache2/htdocs">
 
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
   AllowOverride  AuthConfig Indexes

</Directory>

Reverse Proxy

<VirtualHost *>
ServerName www.dvddatabase.co.uk
ServerAlias dvddatabase.co.uk
RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^/dvd(.*) http://www.dvddatabase.co.uk:8080/dvd$1 [P]
DocumentRoot /home/sites/www.dvddatabase.co.uk/public_html
</VirtualHost>

ProxyPass

ProxyPass /dvd http://www.dvddatabase.co.uk:8080/dvd
ProxyPassReverse /dvd http://www.dvddatabase.co.uk:8080/dvd

Basic Auth Restrict

<LocationMatch /path>
  order allow,deny
  Allow from all
  require user paulkane 
  Authtype Basic
  Authname "private access"
  AuthAuthoritative off
  AuthUserFile /home/sites/userpass.txt
</LocationMatch>

Create password file

[root@localhost ~]# htpasswd -c admin.pass admin New password: Re-type new password: Adding password for user admin

Basic Auth Header

Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

the value is base64 encoded of username:password

Spec

SSL termination

If you have SSL termination on load balancer, to ensure reverse proxy works ensure your server name has the protocol

ServerName https://www.null-pointer.co.uk

Case-insensitive file names on Apache

<ifmodule mod_speling.c>
 CheckSpelling On
</ifmodule>
Personal tools