| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Apache + Lighttpd I'm using Apache as the "main" server - PHP / SQL / etc etc. However, I want to set up lighttpd to serve the 'static' files (image / css / js files). Anyone happen to have any ideas? ![]() EDIT: Running Apache 2.2.6 w/PHP 5.2.5RC2 on CentOS 4.4
Last edited by SecondVersion; 11-06-2007 at 09:21 AM.
|
| |
| | #2 (permalink) |
| NamePros Regular Join Date: Mar 2006 Location: United Kingdom
Posts: 413
![]() ![]() ![]() | I'm assuming you're wanting to setup a lighttpd server on a different physical server, so you'd probably just want something reallly simple (no cpanel or anything) and then just install lighttpd & an ftp server yourself, that way there would be minimal load on the server. Also specs probably wouldn't need to be very high, since there wouldn't need to be much processing going on. Or if you were wanting to set it up on the same physical server it'd have to run on a different port, say 8080, and could be installed side by side with apache, just a little more configuration needed. Although with that solution you probably wouldn't see that much of a performance advantage, and some filtering services may block servers running on ports other than 80 (I know my school used to, college does).
__________________ Linux Screenshots |
| |
| | #3 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Out of interest why do you want to do this? You could set up lighttpd to listen on a different port and use for example www2.domain.com/location/of/image/image.gif as the address but you would have the overhead of running 2 webservers.
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | THREAD STARTER #4 (permalink) | ||||
| Senior Member Join Date: Mar 2005
Posts: 4,948
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| ||||
| |
| | #5 (permalink) |
| NamePros Expert Join Date: Nov 2003 Location: Scotland
Posts: 5,069
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | It will have an overhead even if very little. Running 2 webservers from the same system is not necessarily the best solution. I personally would concentrate on lowering the load mySQL (including restructuring your tables if needed) and apache (such as the number of connections allowed etc) have first and then decide if more action is needed. ????: NamePros.com http://www.namepros.com/programming/392806-apache-lighttpd.html You should also profile your applications to see what (if any) are causing bottle necks. You can use something like Zend Platform that can break down your application to each function call and tell you how much each is taking. You used to be able to get a free developer license, I assume this is still the case. Also consider using something like Zend optimizer. This does not only work for files encoded using Zend Guard, it also speeds up normal code.
__________________ Manage your portfolio using my new Domain Portfolio Management script. Securing Your Domain Name From Theft |
| |
| | #6 (permalink) |
| NamePros Regular Join Date: Mar 2006 Location: United Kingdom
Posts: 413
![]() ![]() ![]() | Have you considered hosting your static files on another account, such as a shared web host? That way your server only does the dynamic stuff, and all static files are offloaded elsewhere.
__________________ Linux Screenshots |
| |
| | #7 (permalink) |
| NamePros Expert Join Date: Oct 2004 Location: South Carolina
Posts: 5,050
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | I'd have to say you're not going to garner much additional speed out of this type of configuration. The solution to your question would be to run them on different ports and pass the connections over to the Lighttpd server, but for what you're saying above, there's not really going to be a difference in performance. |
| |
| | #8 (permalink) |
| NamePros Regular Join Date: Jun 2006 Location: Sydney
Posts: 251
![]() ![]() | ok i have done this a few times, you can use what ever httpd server you wish (i generaly use apache cause i use it else where), the best way to do it i have found, is to setup your httpd with only the require modules to run (ie no perl, php etc etc, just basicly the ability to send files), having stuff like php enabled does slow down even if it's not used. ????: NamePros.com http://www.namepros.com/showthread.php?t=392806 second you'll make to make sure that keep alive is turned on. ok, for your application, i would suggest you add in something like define('STATIC_URL',http://static.domain.com); and link anything that is static like <img src=\"".STATIC_URL."\/images/image01.gif"> that way you'll be able to change it on the fly, and it means you can do a gradual change over time to all your files.
__________________ Site Armory, tools for your website | Webmaster SEO Forums | PHP Tutorial and coding forums |
| |