about: tuning apache2

Discussion in 'HOWTO-Related Questions' started by Ovidiu, Oct 6, 2006.

  1. Ovidiu

    Ovidiu Active Member

    I am refering to this howto: http://www.howtoforge.com/configuring_apache_for_maximum_performance

    has anyone taken an approach to get it done using a perfekt debian install 3.1 ?

    I mean that howto only tells us "roughly" what needs to be done, I still need some advice on how one would go ahead and set up another apache (lightweighted) to server static content...

    I mean how to integrate it with ispcfg...

    can someone give me some hints?
     
  2. Ovidiu

    Ovidiu Active Member

    besides that I did some additional digging and found another similar tutorial:http://servers.linux.com/servers/06/01/27/1813223.shtml?tid=118 the only difference is they use lighttpd but still I need some hints on how to use this with ispcfg especially how to adapt the existing vhosts, or how to create or copy those vhosts so that lightpd serves static content for all of them, maybe even fastcgi...

    here is another similar article using mongrel instead of lighttpd: http://blog.innerewut.de/articles/2...ith-apache-2-2-mod_proxy_balancer-and-mongrel

    and another one for mongrel serving ruby on rails applications: http://mongrel.rubyforge.org/docs/apache.html

    another one: http://blog.codahale.com/2006/06/19...rver-rails-mongrel-apache-capistrano-and-you/
     
    Last edited: Oct 7, 2006
  3. falko

    falko Super Moderator

  4. Ovidiu

    Ovidiu Active Member

    I started reading through the links you gave me, but can you tell me if its basically possible to do this while still using ispcfg on debian:

    have apache2 keep his existing setup and role as a primary server but have him proxy requests for static content to another server and requests for fastcgi to another server?

    I will try first to get the part with the static content running on another small webserver going.

    the problems I see are basically this:

    apache2 is already fully working so I would only need to setup the proxy module for it and have it redirecting requests for i.e. images to the small webserver but that small webserver would need "a copy" of the vhost configuration of apache2 to know which sites and how it is serving, right?

    now how would I go ahead and copy this config if I would use lighttpd as a server for static content??
    basically the same as asked here: http://forum.lighttpd.net/topic/1167#new

    oh and what about having a slim apache2 running in the background serving the static pages? I mean there I could just copy the vhost configurations, that would be the easieast to implement, abd I guess tehre would really be a noticeable difference as my apache2 processes usually have between 12 - 24 MB serving dynamic content...
     
    Last edited: Oct 7, 2006
  5. falko

    falko Super Moderator

    Sure, just put the configuration in the Apache Directives field.

    have apache2 keep his existing setup and role as a primary server but have him proxy requests for static content to another server and requests for fastcgi to another server?

    In the reverse proxy configuration you can specify a totally different URL and port, so it's totally up to you how you do it:

    Code:
    <VirtualHost *:80>
          ServerName myrailsdomain.com
          ProxyPass / http://totallydifferentdomain.com:<port, if different from 80>/
          ProxyPassReverse / http://totallydifferentdomain.com:<port, if different from 80>/
          ProxyPreserveHost on
    </VirtualHost>
    You can use any webserver software you like for serving your static content, this doesn't influence the reverse proxy configuration on your Apache.
     
  6. Ovidiu

    Ovidiu Active Member

    well I understood it like this (I hope I got it right:)

    downlaod source of apache2 => /usr/local/src
    h898552:/usr/local/src/httpd-2.2.3# ./configure --prefix=/usr/local/apache2 --enable-proxy --enable-proxy-http --enable-cache --enable-mem_cache

    these are the modules

    still working on it... I thought I might need, then make, folowed by make install


    => I can start it from /usr/local/apache2/bin/apache2ctl start after modifying the "Listen localhost:88" so now it runs on port 88 and the original can continue running on port 80.

    next step would be to copy /etc/apache2/apache2.conf to /usr/local/apache2/http.conf and change all relevant paths and ports that might disturb...
     
  7. falko

    falko Super Moderator

    Did you check if Debian's Apache package has support for the proxy module? I'm not sure, but you wouldn't need to copmpile your own Apache then...
     
  8. Ovidiu

    Ovidiu Active Member

    well, please excuse my lack of knowledge, but the only way of installing Debian packages known to me is: apt-get install apache2 so I thought that I can install only one instance through the packet managing system,....

    of course it would be a lot easiear if someone could give me some hints on how to do that.

    btw. I succeeded in compiling and installing and I could even start it BUT I am still copying the config file of the "old" apache2, editing and pasting into the new one and its no fun at all....
    I am also suspecting that it is not good, that I downloaded my apache2-source from apache2.org,... I did not find the debian specific one!? ;-(
     
  9. Ovidiu

    Ovidiu Active Member

    to be honest I got nowhere with the second apache2 install :-(
    my next line of thought was, I could install another light web server with only the minimal config, as it needs not serve much, I could just skip the most config steps, I want it to only server static content, so any web serevr would do so I started looking closer at lighttpd and found only this tutorial that gives more info for an install on debian: http://trac.lighttpd.net/trac/wiki/TutorialInstallation and this is an example of a vhost setting for lighttpd:

    besides that it is only available in unstable so I would have to change the status of a lot of stuff from stable to unstable so I just stopped.

    is there anyone here who uses a secondary webserver installed on the same machine and can give me some hints on how to do this? I do not really care anymore what is used for the secondary webserver, I just need it to be able to server static content for vhosts...
     
    Last edited: Oct 9, 2006
  10. Ovidiu

    Ovidiu Active Member

    I finally got a second apache2 up and running and am trying to configure the proxy cfg... first of all in /etc/apache/mods-enabled/proxy.conf there is a proxy on/off switch and nobody has ever mentioned if I have to turn it on there, everybody is only talking about these apache directives to set up proxying....

    I want the first apache to reverse proxy all images to a second apache2 server listening on port 88 and I found 2 different aproaches till now in this posts:

    a)
    b)
    would the second example do what I want if I modified it like this:
    or how should that line look like?
     
  11. falko

    falko Super Moderator

    I think so, I'd try it.
     
  12. Ovidiu

    Ovidiu Active Member

    well, something is wrong:

    all those errors on this site: http://pacura.ru (just testing with this site)

    and a lot of images are missing...
    any idea where I went wrong? why are the other images loading???
     
  13. falko

    falko Super Moderator

    Please check if these images exist, and if not, try to find out if they are in some other directory (with
    Code:
    updatedb
    locate [I]filename[/I]
    ).
     
  14. Ovidiu

    Ovidiu Active Member

    the images are ok, if I take out the reverse proxy directive, the images get loaded... it seems the second static apache2 is not able to find those images....

    have to figure out its logfiles... will be back with ´more details.
     
  15. Ovidiu

    Ovidiu Active Member

    @falko

    interested in doing this (install of a second webserver for static content) as "paid support" for me? Sent you a pm, please give me a sign if interested or not.
     
  16. Ovidiu

    Ovidiu Active Member

    I am still very interested in a second http server serving static content, so if tehre are no news on this one, maybe I can get further with some more questions:

    - does the 2nd apache2 install need the php and mysql module? the sites whose static content I want to proxy is either a wordpress blog or a coppermine gallery (its 2 bigger sites whose load I want to take awy from the 1st apache2 server)
     
  17. Ovidiu

    Ovidiu Active Member

  18. Ovidiu

    Ovidiu Active Member

    I just realized a really important step in all this:

    THE FRONTEND SERVER MUST BE THE LIGHTWEIGHT ONE. otherwise it makes no sense :) I only realized this now....

    so this boils down to this question:

    what exactly do I have to do to get apache2 running on another port, i.e. 88, anything else can stay like it is. ISPCFG can continue managing the apache2 server, I just want it listening to another port.

    THEN I'll try and install litespeed webserver as frontend server and test, maybe in conjunction with this wiki: http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:apache:cpanel
     
  19. falko

    falko Super Moderator

    Replace
    Code:
    Listen 80
    with
    Code:
    Listen 88
    in your Apache configuration. Also replace all occurrences of port 80 in Vhosts_ispconfig.conf and modify the function make_vhost() in /root/ispconfig/scripts/lib/config.lib.php so that it uses port 88 instead of 80.
     
  20. Ovidiu

    Ovidiu Active Member

    thx I knew about the general apache2 config but was unsure where and what I would have to midify inside ispcfg.

    thx
     

Share This Page