Two Apache Clusters

Discussion in 'Server Operation' started by DualFusion, Jul 11, 2008.

  1. DualFusion

    DualFusion New Member

    Hi,

    I have 5 servers:
    1) Loadbalancer/Root
    2) Apache node
    3) Apache node
    4) NFS
    5) Mail

    And I have been trying to get server1 to transfer data to each Apache node depending on there file type, not just what folder they are in. For example I may want to have PHP go to Apache node1 and Ruby into Apache node2

    I have looked at the two tutorials with no success:
    http://www.howtoforge.com/set-up-a-loadbalanced-ha-apache-cluster-ubuntu8.04
    http://www.howtoforge.com/reduce-apache-load-with-lighttpd-debian-etch

    Thanks,
    Kevin.
     
  2. DualFusion

    DualFusion New Member

    Forgot to note that I also want server1 to be DNS. So I basically want a solution that would let me install DNS and would also load-balance between my 2 apache nodes, but will make sure all PHP files go to node1 while all Ruby goes to node2.

    Thanks,
    Kevin.
     
  3. DualFusion

    DualFusion New Member

    **bump bump**
     
  4. DualFusion

    DualFusion New Member

    Can't someone help? Please? This is really important and can't continue without this step. I have been stuck with this problem for a couple days now. Any help is much appreciated.

    Thanks,
    Kevin.
     
  5. tmaleshafske

    tmaleshafske New Member

    Have you looked in to using squid as a reverse proxy
    Squid has options where you can filter by different types of contents.
     
  6. DualFusion

    DualFusion New Member

    I finished looking into squid and saw I can do this: (I think)

    acl PHP urlpath_regex (.+).php

    but I don't know how to redirect them to node1
     
  7. tmaleshafske

    tmaleshafske New Member

    Look at this example squid.conf that I use. The only difference is that I don't have them set-up by type exceptions, but by domain. Also send a post to their mailing list. There are some really good individuals on their user mailing list.
    That are always willing to help. The part where it talks about who is squid a proxy for and the ACL that are related to those servers is what you are going to be interested in. Let me know if it works

    Good Luck
     

    Attached Files:

    Last edited: Jul 14, 2008
  8. DualFusion

    DualFusion New Member

    Ok, so I would have to install squid onto loadbalance server and do something like this:

    Code:
    http_port 80 accel vhost
    forwarded_for on
    
    # Apache Node 1 & 2
    cache_peer x.x.x.x parent 80 0 originserver name=apache1
    cache_peer x.x.x.x parent 80 0 originserver name=apache2
    
    # Put domains in a file 
    acl HostedSites dstdomain "/usr/local/squid/etc/allowed-sites"
    http_access allow HostedSites
    
    # Common ACL
    acl all src 0.0.0.0/0.0.0.0
    acl manager proto cache_object
    acl localhost src 127.0.0.1/255.255.255.255
    acl to_localhost dst 127.0.0.0/8
    acl SSL_ports port 443
    acl Safe_ports port 80          # http
    acl Safe_ports port 21          # ftp
    acl Safe_ports port 443         # https
    acl Safe_ports port 1025-65535  # unregistered ports
    acl CONNECT method CONNECT
    
    # Mime types
    acl php_mime req_mime_type ^application/x-httpd-php$
    acl php_mime req_mime_type ^application/x-httpd-php-source$
    acl php_mime req_mime_type ^application/x-httpd-php3$
    acl php_mime req_mime_type ^application/x-httpd-php3-preprocessed$
    acl php_mime req_mime_type ^application/x-httpd-php4$
    acl ruby_mime req_mime_type ^application/x-httpd-ruby$
    
    # File extensions
    acl php_ext urlpath_regex -i \.php$
    acl php_ext urlpath_regex -i \.pht$
    acl php_ext urlpath_regex -i \.phtml$
    acl php_ext urlpath_regex -i \.phps$
    acl php_ext urlpath_regex -i \.php3$
    acl php_ext urlpath_regex -i \.php3p$
    acl php_ext urlpath_regex -i \.php4$
    acl ruby_ext urlpath_regex -i \.rb$
    acl ruby_ext urlpath_regex -i \.rhtml$
    
    # Allow/Deny cache_peer_access mime type
    cache_peer_access apache1 allow php_mime
    cache_peer_access apache1 deny ruby_mime
    cache_peer_access apache2 allow ruby_mime
    cache_peer_access apache2 deny php_mime
    
    # Allow/Deny cache_peer_access extensions
    cache_peer_access apache1 allow php_ext
    cache_peer_access apache1 deny ruby_ext
    cache_peer_access apache2 allow ruby_ext
    cache_peer_access apache2 deny php_ext
    
    # Allow/Deny http_access
    http_access allow manager all
    http_access allow manager
    http_access deny !Safe_ports
    http_access deny CONNECT !SSL_ports
    http_access deny all
    # Where are the localhost and to_localhost ACL's supposed to go?
    
    # Log traffic
    access_log /var/log/squid/access.log
    Is this good, or would you change anything?

    EDIT: Found out I can do mime types using req_mime_type.

    Thanks,
    Kevin.
     
    Last edited: Jul 15, 2008
  9. tmaleshafske

    tmaleshafske New Member

    I would highly recommend you post to their mailing list I am not a Subject Matter Expert on Squid. So I am not positive that looks correct.
     

Share This Page