lighttp problems

Post Reply
ferdermas
Posts: 3
Joined: Sat May 08, 2010 6:08 pm

lighttp problems

Post by ferdermas » Sat Nov 19, 2011 3:36 pm

some one now how change the default interface to another port or only for 443, and left free the port 80 to make a personal webpage

Mijzelf
Posts: 6199
Joined: Mon Jun 16, 2008 10:45 am

Re: lighttp problems

Post by Mijzelf » Sun Nov 20, 2011 9:57 am

You have different options. Changing the port number is done by editing /etc/lighttpd/lighttpd.conf: server.port = 80
When you change this to, let's say 81, you can run a different website on port 80 by adding the lines:

Code: Select all

$SERVER["socket"]=="192.168.1.1:80" {
	server.document-root = "/var/www/alternate-website-root/"
}
where the ip address is the ip address of your box. Lighty will automatically listen on port 80.

Option 2: You can use virtual servers. When you expose your website using a dyndns address, yourdomain.dyndns.org, then you can offer a different website for people accessing using this url:

Code: Select all

$HTTP["host"]=~"(^|\.)yourdomain.\.dyndns\.org$" {
        server.document-root = "/var/www/yourdomain.dyndns.org/"
}
This way you can host as many websites as you want, all using port 80, providing you have different urls al pointing to your box.
If you want to go for the virtual servers, it's a good idea to provide a catch-all. In my server logs I see lots of scans for known vulnerabilities, all pointing to my public IP. So I provided a catch-all, which is just an empty index.html.

So change the lines

Code: Select all

## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root       = "/var/www/"
in

Code: Select all

## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root       = "/var/www/catchall/"

$HTTP["host"]=~ "(^|\.)yourdomain.\.dyndns\.org$" {
        server.document-root = "/var/www/yourdomain.dyndns.org/"
}

$HTTP["host"]=~ "Iomega-09681e$" {
        server.document-root = "/var/www/"
}
This way you will get the firmware webinterface when you access the box in your lan by it's name (of course you'll have to provide the right name in the script file), and get your own website when you access it via yourdomain.dyndns.org. All other ways gives the catch all.

Post Reply