Run WebKit As Apache Root

Thanks to a tip from Charles Cazabon, who noticed that this works if you give apache bogus Main Doc Root, here's the recipe.

Making Webkit the Document Root in Apache

Changes to apache's httpd.conf

There are several changes to be made...

In Section 2: Main

  • change DocumentRoot directive to a NON-existant directory. Mine is now /var/www/BOGUS

  • change the corresponding Directory block header, like this:

    <Directory /var/www/BOGUS>
  • if you want to have it global (as opposed to Virtual Hosts) then remove the <Directory /> block and replace it with:

    <Location />
        WKServer localhost 8086
        SetHandler webkit-handler
    </Location>

In Section 3: Virtual Hosts? (OPTIONAL)

The same location directive can be added to a VirtualHost block in Section 3. That's what I'm doing now:

  • In Section 2 leave alone your <Directory /var/www/BOGUS>

  • turn on virtual hosts like this:

    NameVirtualHost *
  • setup your Virtual Host something like this:

    <VirtualHost *>
        ServerName www.myserver.com
        <Location />
            WKServer localhost 8087
            SetHandler webkit-handler
        </Location>
    </VirtualHost>
  • if you want other virtual hosts (or a default host) just set up another virtual host block. They are in order of importance. This is all covered in the apache docs

Good luck!

-- MattFeifarek - 09 May 2002

Run Webkit as Document root with Apache 2 =========================================v

As many of you may have noticed with Apache2 you can no longer use the bogus document root trick mentioned above. To get around this, this is what has worked for my (at least on Windows with Apache2 and mod_webkit)

  • Add your apache Document root as the default Webkit context

  • Add your webkit location:

    <Location /WK>
    WKServer localhost 8086
    SetHandler webkit-handler
    </Location>
  • Now make Apache associate py files with the /wk location:

    Action py-serverpages /WK/
    AddType py-serverpages .py

Virtual hosts are almost the same thing

  • turn on virtual hosts as metioned above

  • now add the virtual host directory to your webkit contexts

  • within the virtual host declaration add a new webkit location:

    <VirtualHost *>
        ServerAdmin webadmin@someplace.com
        DocumentRoot "/virhost"
        ServerName virhost.com
        ErrorLog logs/virhost.com-error_log
        CustomLog logs/virhost.com-access_log common
    
        <Location /WK/virhost>
            WKServer localhost 8086
            SetHandler webkit-handler
        </Location>
    
        Action py-serverpages /WK/virhost/
        AddType py-serverpages .py
    </VirtualHost>

That should do it all without the use of rewrites

-- JoseGalvez - 28 Dec 2002

Model Two plus One Has slightly different example of using doing this with Apache2

-- LukeHolden - 07 Jan 2003

Here's another trick for users of the cgi-wrapper, tested in apache1.3:

...
ScriptAlias  /mywebware /path/to/webkit.cgi
RewriteEngine On
# Only rewrite "/index.html", which also rewrites "/"
# in the default apache configuration:
RewriteRule ^/index.html /mywebware/ [L,PT]
...

This is neat if you actually want to have all webware stuff below a certain directory ("/mywebware" in the example) but have the apache start page to be the webware start page as well. All webware stuff is in /mywebware now, all images in /images or css in /css get served statically, but still apache root is Webware powered.

(I wanted to have it this way on http://normalmailorder.de where /index.html is routed to be http://normalmailorder.de/shop/ )

-- FrankBarknecht