Serving up multiple websites from same web server using Squid 2.7.

Primedius
Primedius used Ask the Experts™
on
Right now we can only properly cache requests to "example.domain.com" set with the defaultsite parameter, any of the other sites hosted on webserver are not cached. Is this simply a matter of adding the vhost parameter to the end of the http_port command? See below:

acl all src all
acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32
acl webserver dst 192.168.111.222/32
http_access allow webserver
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
http_access allow all
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 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access deny all
icp_access allow localnet
icp_access deny all

http_port 192.168.111.114:80 accel defaultsite= example.domain.com
cache_peer 192.168.111.222 parent 80 3130 no-query no-digest originserver

hierarchy_stoplist cgi-bin ?

cache_dir ufs g:\cache 5000 16 256
cache_replacement_policy lru
maximum_object_size 50096 KB


access_log c:/squid/var/logs/access.log squid
cache_log c:/squid/var/logs/cache.log
cache_store_log c:/squid/var/logs/store.log
max_stale 1 week
refresh_pattern . 2 20% 4320 override-expire
refresh_pattern /bus/ 15 75% 4320 override-expire
refresh_pattern /images/ 15 75% 4320 override-expire


acl shoutcast rep_header X-HTTP09-First-Line ^ICY.[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache

forwarded_for on

coredump_dir c:/squid/var/cache


Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
http_port 192.168.111.114:80 accel defaultsite= example.domain.com

The above line tells squid to act as web server and listen to IP 192.168.114 socket 80. All requests to this ip and port are in turn made to the defaultsite example.domain.com.
To accelerate multiple hosts add the following
httpd_accel virtual
and change the above line
http_port 192.168.111.114:80 accel vhost defaultsite= example.domain.com

Author

Commented:
Thanks Tanmay but the directive "httpd_accel" does not seem to exist in Squid 2.7.
Have you tried changing the line
http_port 192.168.111.114:80 accel defaultsite= example.domain.com
to read
http_port 192.168.111.114:80 accel vhost defaultsite= example.domain.com

If it does not work this way then we may have to add another interface e.g. eth0:1 ip 192.168.111.115 and add the line
http_port 192.168.111.115:80 accel defaultsite= new.domain.com

cheers..

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial