The problem

When you go to http://server.example.org/, you see Deki immediately.  Worse, if you install an application like phpMyAdmin, and browse to http://server.example.org/phpMyAdmin, you see a blank Deki page named 'phpMyAdmin' rather than the application.

You would like to set your server up so that you go to http://server.example.org/dekiwiki/, and can go to http://server.example.org/otherapp to see the other application.

Short answer: Sorry, you can't.

(What a horribly dismissive answer!)

Long answer: That isn't The Right Way.  But this is!

Deki isn't designed to run in a subdirectory.  It's designed to run as its own virtual host, or subdomain. 

Setting up your own subdomain

Imagine you have a setup like this:

Hosts file:

10.7.0.153    server.example.org

DNS:

server.example.org.        86400   IN      A       10.7.0.153

What you need to do is add another entry, something like this.

Hosts file:

10.7.0.153    server.example.org deki.example.org

DNS:

server.example.org.         IN      A       10.7.0.153
deki.example.org.           IN      PTR     server.example.org.

In reality, you will probably say "Network Administrator or Hosting Control Panel, please create a 'deki.example.org' alias for me".

Now, you have two names both pointing to the same IP address.

Setting up Apache for Virtual Hosting

The magic here is that web servers can serve different requests based on what host name you are requesting - even if they are on the same IP. 

Changing the ServerName of the Deki virtual host

The Apache control file for Deki on the VM is /etc/apache2/sites-available/dekiwiki.  This section the virtual host starts like so:

<VirtualHost *>
    ServerName dekwiki

On the VM, this is the only virtual host that is enabled, so it will serve results for all names. If you want to host something else on the same machine, this probably isn't what you want.  You want Deki to only answer to requests on deki.example.org

Let's set that up.  Change the ServerName like so:

ServerName deki.example.org

This means that this virtual host block will now only listen to requests for deki.example.org

Setting up another virtual host

If you enable the default site:

dekiwiki:/etc/apache2/sites-available# a2ensite default
Site default installed; run /etc/init.d/apache2 reload to enable.
dekiwiki:/etc/apache2/sites-available# /etc/init.d/apache2 reload
 * Reloading web server config...                                                                                      
                                                                                                                 [ ok ]

and go to http://server.example.org/, you will be redirected to http://server.example.org/apache2-default/and see "It works!", (the entire contents of the default Apache web site on Debian).  You now have to go to http://dekiwiki.example.org/ to see the wiki.  You can configure server.example.org how you please - and create any other virtual hosts you want.

Longer answer: you could, but you shouldn't.

There are parts in Deki where it is hard coded to believe it is at the root of its subdomain (i.e. at /, not at /dekiwiki/).  There has been an offer to fix this, but as of this writing, no patch has been submitted.  If you're interested in helping out, please drop by the thread and offer your assistance!

(It should be noted at this point that solely based on length of text, the long answer is substantially longer than the longer answer.)

 

Tag page
You must login to post a comment.