Jump to content

[SOLVED] Is there a way to make apache and lighttpd work together on the same machine?


ivytony

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!!!

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.