ivytony Posted October 14, 2008 Share Posted October 14, 2008 I'm currently using Lighttpd to serve websites written in PHP and I like the speed and light load of Lighttpd webserver. Recently, we need to run a youtube-like script on the server which doesn't work well on Lighttpd. Rather than replacing Lighttpd with Apache, we would like to install apache on top of Lighttpd - Apache will be serving PHP scripts and Lighttpd will server media files like audio, images and videos (e.g. FLV). I know I will need to change the port numbers for both web servers (apache on port 80 and lightty on port 81?) However, I don't know how to make this happen. Or I have to rebuild another server using apache only? Could some experts here show me how to do it in a bit detail? I appreciate it. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 14, 2008 Share Posted October 14, 2008 You can run two HTTP servers from one box yes, provided they operate on separate ports, eg 80, 81 The problem is you'll need to use two different links on your site in order to get content from either of the two servers. eg domain.com/ retrieves content from the HTTP server running on port 80 domain.com:81/ retrieves content from the HTTP server running on port 81 I think you'll be better off using one or the other. Not both together. Quote Link to comment Share on other sites More sharing options...
trq Posted October 14, 2008 Share Posted October 14, 2008 Depending on what it is exactly your trying to achieve you can also use Apache to proxy request to the lightttp server. eg; ProxyRequests Off ProxyPass /imgs http://lighthttp:81/imgs ProxyPassReverse /imgs http://lightttp:81/imgs Quote Link to comment Share on other sites More sharing options...
ivytony Posted October 14, 2008 Author Share Posted October 14, 2008 Thank you both so much for the detailed reply. So on the server, I can safely install apache on top of Lighttpd and then configure apache to port 80 and Lighttpd to port 81. In each virtual host record in apache httpd.conf, I just need to put the following code to forward the media (images, audio and video) request to lighttpd. ProxyRequests Off ProxyPass /imgs http://lighthttp:81/imgs ProxyPassReverse /imgs http://lightttp:81/imgs I don't need to use the proxy module in Lighttpd, right? Another question is: do you recommend stacking apache on lighttpd in the same machine? or I better run them on separate servers to relieve server loads? The reason why I ask this is I gotta think about possible growth in future. This is really cool! thanks again!!! Quote Link to comment Share on other sites More sharing options...
ivytony Posted October 14, 2008 Author Share Posted October 14, 2008 My lighttpd uses fastCGI, I wonder if the apache to be built has to use fastCGI for PHP or not. Sorry, I have too many questions Quote Link to comment Share on other sites More sharing options...
trq Posted October 14, 2008 Share Posted October 14, 2008 So on the server, I can safely install apache on top of Lighttpd and then configure apache to port 80 and Lighttpd to port 81. Yes. In each virtual host record in apache httpd.conf, I just need to put the following code to forward the media (images, audio and video) request to lighttpd. That was a simple example, but yeah, you get the idea. You'll want to look at the docs relating to mod_proxy for more details. do you recommend stacking apache on lighttpd in the same machine? or I better run them on separate servers to relieve server loads? Of course using two separate machines will allow better performance, still, YOU need to way up the benefits vs cost. Quote Link to comment Share on other sites More sharing options...
ivytony Posted October 14, 2008 Author Share Posted October 14, 2008 you guys are awesome! thank you thorpe! I've googled these two articles that are very helpful for understanding how to run apache & lighttpd simultaneously. I would like to post them here for other users who are in the same situation as me. http://www.inerciasensorial.com.br/2007/06/10/perils-of-software-development/lighttpd-with-apache/ http://www.linux.com/feature/51673 cheers! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.