plainblack.com
Username Password
search
Bookmark and Share
Subscribe

Customizing WRE Configuration

The WRE comes preconfigured for the most common needs. However, the Apache configuration files can be customized to meet unusual requirements as well. Let's outline some of the possibilities below:

Firewall Configurations

Internal & External modproxy IP's

If you access your modproxy server from alternate IP's, add the following directives to proxy the request from the external address to an internal address. Place this after the directives dealing with port number.

    # external ip address
RewriteCond %{HTTP_HOST} ^156\.165\.200\.124$ [NC]
RewriteRule ^(.*)$ http://INTERNAL/$1 [P]

Non-standard modproxy port

If you put your modproxy server onto a non-standard port or use port forwarding to get from a firewall to your server, you will need to modify the modproxy configuration for your host to include the additional port. Here's an example:

    # deal with port number in HTTP_HOST
RewriteCond %{HTTP_HOST} :80 [OR]
RewriteCond %{HTTP_HOST} :8080
RewriteRule ^/(.*) http://%{SERVER_NAME}/$1 [P]

Protect your uploads directory

See What to do if privileges on the uploads directory don't seem to work.

Canonical Hostnames

If you have a virtual host with several values for ServerAlias and would like to force the use of a particular hostname, in preference to other hostnames which may be used to reach the same site, use the following:

    # force www2.yourhost.com to www.yourhost.com
RewriteCond %{HTTP_HOST} ="www2.yourhost.com"
RewriteRule ^/(.*) http://www.yourhost.com/$1 [L,R=301]

Rewrite url based on cgi parameters 

Use mod_rewrite to rewrite url based on a set of parameters for a cgi script. This recipe could be useful if you are replacing a CGI script with a WebGUI asset.

 	#redirect to index.html if cgi parameters match op=logout&something=else..
RewriteCond %{QUERY_STRING} ^op=logout&something=else(.*)
RewriteRule ^/index/script.cgi /index.html [R]

Configuring a non-WebGUI Host

See "How To Configure a Static, non-WebGUI site".

Adding UserDir Support

The Apache module mod_userdir allows user-specific directories to be accessed using the http://example.com/~user/ syntax. In WRE 0.7.x, this module was included in /data/wre/prereqs/apache/modules. To add userdir support, add the following to your preferred modproxy config:

LoadModule userdir_module modules/mod_userdir.so
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
UserDir public_html
UserDir disabled
UserDir enabled william

#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
<Directory /home/*/public_html>
AllowOverride AuthConfig FileInfo Indexes Limit
<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
Options +ExecCGI +Indexes +MultiViews +SymLinksIfOwnerMatch
#AddOutputFilter INCLUDES html
</Directory>

<Directory /home/*/public_html/cgi-bin/>
AllowOverride FileInfo AuthConfig Limit Indexes
Options +ExecCGI
</Directory>

 

NB: WRE 0.8.x appears to have removed the mod_userdir module.

Keywords: apache WRE

Search | Most Popular | Recent Changes | Wiki Home
© 2023 Plain Black Corporation | All Rights Reserved