Lighttpd Subhost issue

I am setting up a site and would like subhosts for both phpmyadmin and my xcache admin.

I have tried several different methods with no success. The main domain site and www.domain work perfectly.

I'll call it example.co.uk

www.example.co.uk works fine and using my lighttpd config

example.co.uk also works as expected also using the config

I have the following A Name records set

database and xcache

I have tried:

$HTTP["host"] == "database.example.co.uk" {
    server.document-root = "/usr/share/phpmyadmin"
}
$HTTP["host"] == "xcache.example.co.uk" {
    server.document-root = "/usr/share/xcache/admin"
}

But this isn't working. Instead I am shown a server not found page.

Any help would be appreciated.

6 Replies

Don't worry. The problem was just DNS propagation. I should learn to not be so inpatient.

There is also the simplevhost module, which lets you define vhosts with directories; adding a new vhost is as simple as adding a directory. There are limitations, of course, the "simple" part means that it's really intended for people who don't need anything fancy.

Surely, the code above isn't all there is to your configuration, is it? If you're inclined to expose your phpmyadmin and xcache admin interfaces to the whole world like that, keep in mind that you can say byebye to your database the moment you connect to one of those at your local Starbucks. At the very least, enable digest authentication; then put some self-signed SSL certificates in place.

It was only a quick fix. Not intended to remain up for long at all. I understand the security implications with it.

OFF TOPIC:

What suggestions would you have to securing such parts of a site? as it would be nice to have access to them quickly if needed in the future.

Oh and thank you for the replys.

@dacoxall:

What suggestions would you have to securing such parts of a site?
Make them only accessible from localhost. When you need to access them, set up port forwarding through an SSH tunnel.

ssh -L 8080:127.0.0.1:80 username@hostname

If you're using PuTTY on Windows, the relevant settings are found in Connection -> SSH -> Tunnels.

Then you can browse to http://localhost:8080/phpmyadmin (or something like that) on your computer. The connection will be forwarded to http://localhost[:80]/phpmyadmin on the linode.

Thanks for the info. I'll have to look into that. :D

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct