nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Apache and lighttpd together

This is a discussion on Apache and lighttpd together within the Web servers forums, part of the Mastering Servers category; Hi I recently came to know that : lighttpd is used by many well-known sites. The typical scenario is using ...


Go Back   nixCraft Linux Forum > Mastering Servers > Web servers

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-15-2007, 05:16 PM
anjanesh's Avatar
Junior Member
User
 
Join Date: Feb 2007
Location: Mumbai, India
My distro: Fedora
Posts: 3
anjanesh
Default Apache and lighttpd together

Hi

I recently came to know that :
Quote:
lighttpd is used by many well-known sites. The typical scenario is using lighttpd as off-load server to push out static content and leave to complex work to another server.
So does this mean that its better to have Apache running on another port, say 82 and lighttpd on 80 so that the pages are served to the client via lighttpd, but if theres a complex php script to run, use Apache instead ?

How does that work ?

index.php
PHP Code:
<html>
.....
<body>
<?php
echo simpleFunction(); // run using lighttpd
?>
<?php
echo complexFunctionATport82(); // Something like this...
?>
</body>
</html>
Or am I totally missing the point ?

Thanks
Reply With Quote
  #2 (permalink)  
Old 07-16-2007, 03:54 AM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 545
rockdalinux is on a distinguished road
Default

Quote:
Or am I totally missing the point ?
Yes you are totally missing the point. php function cannot connect on different ports. A few scenarios

a) as a subdomain
images.domain.com -> lighttpd to send images
www.domain.com -> Apache with PHP (all images and static pages linked from images.domain.com)

b) Lighttpd as proxy
lighttpd run on port 8080 on same server
Apache run on port 80 with proxy_module
You configure Apache to serve images via lighttpd stored in /images directory by adding following line of code to httpd.conf:
Code:
ProxyRequests Off
 ProxyPreserveHost On
 ProxyPass /images http://0.0.0.0:8080/
ProxyPassReverse / http://0.0.0.0:8080/
Above setup is more common, but some people use lighttpd for all kind of work.
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
  #3 (permalink)  
Old 08-29-2007, 04:35 PM
b3n b3n is offline
Junior Member
User
 
Join Date: Aug 2007
My distro: RHEL ES4
Posts: 4
b3n is on a distinguished road
Default

Where abouts in httpd.conf would I write those Proxy lines?

Every where I tried it causes Apache to fail to start.
Reply With Quote
  #4 (permalink)  
Old 08-29-2007, 04:45 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 478
monk is an unknown quantity at this point
Default

Quote:
Originally Posted by b3n View Post
Where abouts in httpd.conf would I write those Proxy lines?

Every where I tried it causes Apache to fail to start.
Correct syntax is as follows. Also you need to configure lighttpd to listen on 8080.

ProxyRequests Off
ProxyPreserveHost On
ProxyPass /images http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
__________________
May the force with you!
Reply With Quote
  #5 (permalink)  
Old 08-29-2007, 05:11 PM
b3n b3n is offline
Junior Member
User
 
Join Date: Aug 2007
My distro: RHEL ES4
Posts: 4
b3n is on a distinguished road
Default

Hmm still wont start.

Do I add those lines to the end of httpd.conf? Or do they go in a <Location /> area?

Sorry maybe I should mention this. I'm just trying to get this working on my local setup first, (Windows XP, Apache 2). Does that make a difference?

I have lighttpd running on 8080 - does it need to be running before I start Apache?
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
lighttpd ProxyPass thunderbirdsei Web servers 0 04-30-2008 10:50 PM
Inactivity timer for lighttpd petu Web servers 0 03-11-2008 12:49 PM
Can lighttpd access log be filtered? petu Web servers 2 01-18-2008 10:59 AM
redirect to www in lighttpd muks Web servers 11 06-02-2007 10:55 PM
lighttpd user cgi-bin setup chiku All about FreeBSD/OpenBSD/NetBSD 1 12-15-2006 01:52 AM


All times are GMT +5.5. The time now is 04:17 PM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35