0

I've recently installed Lighttpd on Ubuntu 10.04. I used the standard concfig file without modification and placed my content in /var/www. I opened a browser typed in the URL www.myexample.co.uk and the content was delivered. Brilliant!

I need to use the server to host more than one web page so I configured the simple vhost module. I left the vhost config file /etc/lighttpd/conf-enabled/10-simple-vhost.conf almost as standard too:

simple-vhost.server-root = "/var/www"
simple-vhost.document-root = "html"
#simple-vhost.default-host = "www.example.com"

I then moved my content from /var/www to /var/www/myexample.co.uk/html/, restarted the server and opened my browser to test things out.

Now I see a page showing me Index of / which then has a link to a folder called myexample.com. Clicking on this delivers Index of /myexample.co.uk which has a link to a folder called html. Clicking on this serves up my content.

Clearly this isn't working how I intend it too. Any ideas would be much appreciated!

Koisto
  • 1
  • 1
  • 2

3 Answers3

0

Guessing from http://redmine.lighttpd.net/wiki/1/Docs:ModSimpleVhost you still need a

simple-vhost.default-host = "example.org"

entry or similar. Does the hostname you are using match the directory name exactly?

Can you break the config file and see the service fail to start, to prove you are editing the config file it is using?

TessellatingHeckler
  • 5,676
  • 3
  • 25
  • 44
0

After some hacking around I managed to get it to work by setting /etc/lighttpd/conf-enabled/10-simple-vhost.conf up as follows:

simple-vhost.server-root = "/var/www"
simple-vhost.document-root = "html"
simple-vhost.default-host = "myexample.co.uk"

Basically I needed to set a default host value and get rid of the www part.

Koisto
  • 1
  • 1
  • 2
0
  • run with the ubuntu provided script helper sudo lighty-enable-mod simple-vhost (or lighttpd-enbale-mod) by which change your sitting in /etc/lighttpd/lighttpd.conf and move related files from /etc/lighttpd/conf-available to conf-enabled folder to include simple-vhost mod.
  • sudo /etc/init.d/lighttpd force-reload
  • in conf-enabled folder, there is a temple named 10-simple-vhost.conf. Edit it according to your requirement.

    personal advices:

  • Divided each sites by making /sites/vhost/www.example.com folder.
  • place log, www, cgi etc.. folder for each host
  • remember to set these folders with correct permission

    reference

chris Ren
  • 1
  • 2