[Seaside] Apache configuration

Stefan Schmiedl s at xss.de
Sat Oct 4 08:17:51 UTC 2008

Hi Bill,

On Fri, 03 Oct 2008 19:28:35 -0400
"Bill Schwab" <BSchwab at anest.ufl.edu> wrote:

>  Many posts and blogs insist the configuration is in fact easy to do,

just like Smalltalk programming, it is easy, if you are used to it.
Once you've configured a dozen apaches, it'll be easy as pie.

> http://lists.squeakfoundation.org/pipermail/seaside/2007-November/015167.html
> Now for my dumb question of the week: is that the entire configuation
> file, as in put that in place of httpd.conf and the thing runs?  

No, it is not. Depending on where you run your apache and which version
it is, the changes might need to be done in httpd.conf or somewhere in a
subdirectory called sites-available or vhosts.d.

> Clearly
> changes would be required, but if things truly can be that simple, it
> seems as though one could create a largely "relocatable" config file,

If you know how your local apache does things, it is already
"relatively" relocatable.

> # "Stolen" from above-referenced archived message :)
> LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
> LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
> LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
> LoadModule ssl_module /usr/lib/apache2/modules/mod_ssl.so

Search your local apache config for other LoadModule statements.
You might even find the entries for the required modules there, albeit
commented out. If not, make sure that the paths are correct and add

> ServerName www.goodsexnetwork.com 

This line outside of any VirtualHost directive declares a "global" name
for the server, which is going to be relevant if somebody accesses the
server by IP only, ie. without using a hostname apache can use to
further process the request.

> NameVirtualHost

This line usually looks like "NameVirtualHost *:80" which basically
tells apache to setup the following virtual hosts for requests on
http port 80.

> <virtualhost>
> ServerName www.goodsexnetwork.com 
> RewriteEngine on
> ProxyRequests off
> DocumentRoot /var/www
> RewriteRule ^/(.*)$ https://%{SERVER_NAME}/$1 [L,R]
> </virtualhost>

"If you can't file the requested filename, ask the https server". This
is a policy decision: Any *files* accessible under DocumentRoot are
sent over http connections, everything else is handled by seaside
over https.

> NameVirtualHost
> <virtualhost>
> ServerName www.goodsexnetwork.com 
> RewriteEngine on
> ProxyRequests off
> ProxyPreserveHost on
> SSLEngine on
> SSLCertificateFile /etc/apache2/ssl/apache.pem
> DocumentRoot /var/www/ssl
> ProxyPass /seaside/fred http://localhost:9090/seaside/fred 
> ProxyPassReverse /seaside/fred http://localhost:9090/seaside/fred 
> RewriteRule ^/$ http://localhost:9090/seaside/fred/$1 [P,L]
> </virtualhost>

This VirtualHost block contains the core elements you will need for any
apache proxy to seaside.

As reference, here's what a site under development looks like on one of
my machines:

<VirtualHost *:80>
ServerName whatever
ProxyRequests Off
ProxyPreserveHost On

<Proxy *>
  Order deny,allow
  Allow from all

<Location />
  AuthType Basic
  AuthName "Intranet-Demo"
  AuthBasicProvider dbm
  AuthDBMUserFile /etc/apache2/passwd
  AuthDBMGroupFile /etc/apache2/passwd
  Require group whatever


The "special effect" here is that I have put it behind simple http
based authentication, so that only a few users can access the site.

Another sample configuration:

<VirtualHost *:80>
    ServerAdmin my at email.address
    DocumentRoot "/var/www/ab/htdocs"
    ServerName ab
    ServerAlias ab.domain.com
    ErrorLog "/var/log/apache2/ab-error.log"
    CustomLog "/var/log/apache2/ab.log" common

    <Directory "/var/www/ab/htdocs">

        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride None
        Order allow,deny
        Allow from all


  ProxyRequests Off
  ProxyPreserveHost On

  <Proxy *>
    Order deny,allow
    Allow from all

  RewriteLog /var/log/apache2/ab-rewrite.log
  RewriteLogLevel 0
  RewriteEngine On

  RewriteRule ^/?$ [P,L]
  RewriteRule ^/(.+)$$1 [P,L]


In this case, I also have some legacy CGI-based stuff and some other
pages on that virtual host and I obviously had difficulties in setting
up the rewrite rules as I'm still prepared for activating rewrite

I have a redirection for folks accessing the url
"http://ab.domain.com/" to be redirected to the entry point of the
seaside application. The final two Rewrite... lines let apache handle
availabe files (in this case: .js, .css, images) and pass the "real"
requests on to seaside.


More information about the seaside mailing list