setting up lighttpd as a subdomain controller

Posted this over on their forum but not sure how active it is and this place is my new hot spot :) I have a tube script that at this point seems to be a major PITA to use. All the script really tells me is:
Code:
lighttpd running media.domain.com pointed at /home/user/domain.com/media/ + mod_h264_streaming
The script writer is suggesting I use an old version:
http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Lighttpd-Version2

I would prefer to use the one that works with FreeBSD ports so it updates with new releases/fixes.

My server is running FreeBSD 9.1
lighttpd-1.4.32_1
lighttpd-mod_h264_streaming-1.4.32_1

The server uses apache as it's main httpd. What I would like to do is configure lightptd to point to media.mydomain.com. This folder is at /home/username/domains/mydomain.com/public_html/media/. I know people are going to say it will double as apache will have it open to http://www.mydomain.com/media but the script is setup this way and I believe prevents it.

I want to point out not only am I new to lighttpd, but also FreeBSD. I'd post my config file, but at this point I'd rather just make a new smaller one with only the stuff I am using. Here are some of the main things I added:
Code:
server.modules = (
"mod_access",
"mod_h264_streaming",
"mod_flv_streaming", I think this is built into the newest version of lighttpd??? I know I don't have a port for it like H264
)

flv-streaming.extensions = ( ".flv" )
h264-streaming.extensions = ( ".mp4" )

$HTTP["host"] =~ "media.DOMAIN.com" {
server.document-root = "/home/USER/domains/DOMAIN.com/public_html/media/" 
accesslog.filename = "/home/USER/domains/DOMAIN.com/logs/" 
}
I commented out the listening socket which might not of been right. It won't work on port 80 because apache is using it and if I set it to 81, how will lightpd know when someone goes to media.domain.com?

IPv4 listening socket
Code:
$SERVER["socket"] == "0.0.0.0:80" { }
Again want to point out I am new to FreeBSD and lighttpd, so if you don't mind, if you could explain your answers a little, that would make things a little easier on me. Any help would be great!

Thanks again,
Brian
 

Attachments

  • lighttpd.conf.txt
    11 KB · Views: 751
beamar said:
It won't work on port 80 because apache is using it and if I set it to 81, how will lightpd know when someone goes to media.domain.com?
Howdy Brian! Props to you for at least trying to tackle this. ;)

So if your going to use a non-standard port number for web services you will need to reference that port number in the URL. For example:

http://media.domain.com:81

Alternatively, if the originating URL cannot contain a port number, (for whatever reasons) you could get fancy with an configuration using HTTP status 301 redirection. You will need to use a different FQDN such as:

http://media1.domain.com

so as to use "media1" to trigger the redirection.

To rehash the 301 redirect, both media.domain.com and media1.domain.com will have A records that point to the same IP address. When Apache is asked about "media1.domain.com" it will do a 301 redirect to "media.domain.com:81" thereby causing the other web server to fulfill the request.

HTH's

:D
 
Thanks! Yes, learning this stuff on the fly isn't easy!

Gave up on lighttpd and going with nginx.

Found this little article on the web somewhere:

You can't run them both on the same port. By default both will want to conquer 0.0.0.0:80 and that's not on. Two simple choices:

Add an IP, bind nginx on its port 80, point DNS at that IP.
Set nginx up on another port (eg 8080) and use Apache's ProxyPass directive to push one virtualhost back to nginx:

Code:
<VirtualHost *:80>
    ServerName git.example.com
    DocumentRoot /path/to/myapp/public
    ProxyPass / [url]http://localhost:8080/[/url]
    ProxyPassReverse / [url]http://localhost:8080/[/url]
</VirtualHost>

This is actually quite common - just in reverse. Most people put nginx on the raw port 80 and let it handle raw file I/O, and proxy back to Apache if they need something like mod_php. You could do that but it's very likely more work.

There are —as always— a hundred thousand million different ways of doing these sorts of things. These are the two main ones.

Have yet to give it a try. Will keep you posted!


Brian
 
Back
Top