Re: [squid-users] Squid 2.6 and Wordpress

2009-01-07 Thread Frog
Hi,

First off apologies for top posting - This mail client (Zimbra webmail) doesn't 
work well with replies contained in the original mail.

If you want to increase Squid's chances of caching WordPress then you could 
install a Wordpress cache plugin as well. I use Squid as a reverse proxy and on 
my WordPress installation I use the WP-SuperCache plugin.

It creates static cached pages of your popular blog entries which are easily 
cached in turn by your webserver.

It is available from here:

http://ocaoimh.ie/wp-super-cache/

Regards
-Frog

- Original Message -
From: "Dan Casey" 
To: squid-users@squid-cache.org
Sent: Tuesday, 6 January, 2009 17:21:15 GMT +00:00 GMT Britain, Ireland, 
Portugal
Subject: [squid-users] Squid 2.6 and Wordpress

I'm running squid 2.6 from CentOS 5 repository, as an http accelerator
for wordpress.

I've got it working to a point using a configuration I found elsewhere
(I'm not very familiar with squid yet, and most docs I've found are not
relevant to this version).
It is successfully caching the images as stuff and other static content,
but I would like it cache some of dynamic pages as well.  I've played
around with the refresh_pattern's a little bit, but didn't have any
luck.  Here is an example from the access log. 

ping.php is specifically not cached, but the other one "?p=1" I would
like to cache.



Re: [squid-users] Squid 2.6 and Wordpress

2009-01-06 Thread Amos Jeffries

Dan Casey wrote:

I'm running squid 2.6 from CentOS 5 repository, as an http accelerator
for wordpress.

I've got it working to a point using a configuration I found elsewhere
(I'm not very familiar with squid yet, and most docs I've found are not
relevant to this version).


The FAQ has a current configuration setup tutorial
  http://wiki.squid-cache.org/SquidFaq/ReverseProxy

there are large access control settings missing from your config that 
are needed to make things work efficiently and securely. Additional to 
the notes I've made below.




It is successfully caching the images as stuff and other static content,
but I would like it cache some of dynamic pages as well.  I've played
around with the refresh_pattern's a little bit, but didn't have any
luck.  Here is an example from the access log. 


ping.php is specifically not cached, but the other one "?p=1" I would
like to cache.






# /etc/squid/squid.conf ##
# Basic parameters
visible_hostname localhost


Calling the gateway machine "localhost" may cause all sorts of trouble 
and confusion. Please try using a proper machine or domain FQDN.



# This line indicates the server we will be proxying for
http_port 80 defaultsite=wordpress.dom.tld
# And the IP Address for it
cache_peer 10.10.10.10 parent 80 0 no-query originserver
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
# Where the cache files will be, memory and such
cache_dir ufs /var/spool/squid 1 16 256
cache_mem 256 MB
maximum_object_size_in_memory 32 KB
# Log locations and format
logformat common %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %h" "%{User-Agent}>h" %Ss:%Sh
access_log /var/log/squid/access.log squid
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log


store log is not usually needed. you can save yourself a lot of storage 
space setting this to "none".



hosts_file /etc/hosts
# Basic ACLs
acl all src 0.0.0.0/0.0.0.0
acl mydomain dstdomain .example.com


That should be set properly to the wordpress domain.


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 Safe_ports port 80
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access allow localhost



http_access allow all


Drop that allow all!


http_access allow mydomain
http_access deny all
http_reply_access allow all
icp_access allow all
cache_effective_group squid


should only need cache_effective_user here. Group plays wickedness with 
permissions.



coredump_dir /var/spool/squid
forwarded_for on
emulate_httpd_log on
redirect_rewrites_host_header off
buffered_logs on

refresh_pattern -i ping.php 0 0% 0 override-expire
refresh_pattern -i .php   0 50% 30
refresh_pattern -i .js0 50% 300
refresh_pattern -i .css   0 50% 300
refresh_pattern -i .jpg   0 50% 300
refresh_pattern -i .gif   0 50% 300
refresh_pattern -i .png   0 50% 300
refresh_pattern -i .swf   0 50% 300
refresh_pattern -i .html  0 50% 300
refresh_pattern -i .shtml 0 50% 300

client_persistent_connections on
server_persistent_connections on
pipeline_prefetch on
strip_query_terms off



Amos
--
Please be using
  Current Stable Squid 2.7.STABLE5 or 3.0.STABLE11
  Current Beta Squid 3.1.0.3


Re: [squid-users] Squid 2.6 and Wordpress

2009-01-06 Thread Chris Robertson

Dan Casey wrote:

I'm running squid 2.6 from CentOS 5 repository, as an http accelerator
for wordpress.

I've got it working to a point using a configuration I found elsewhere
(I'm not very familiar with squid yet, and most docs I've found are not
relevant to this version).
It is successfully caching the images as stuff and other static content,
but I would like it cache some of dynamic pages as well.  I've played
around with the refresh_pattern's a little bit, but didn't have any
luck.  Here is an example from the access log. 


ping.php is specifically not cached, but the other one "?p=1" I would
like to cache.

1231260321.328682 192.168.1.20 TCP_MEM_HIT/200 1541 GET
http://wp.dom.tld/wp-content/themes/default/images/bg_body.gif - NONE/-
image/gif
1231260321.331  3 192.168.1.20 TCP_MEM_HIT/200 8116 GET
http://wp.dom.tld/wp-content/themes/default/images/wp_blog_head_01.png -
NONE/- image/g
1231260321.332  0 192.168.1.20 TCP_MEM_HIT/200 2033 GET
http://wp.dom.tld/wp-content/themes/default/images/wp_blog_head_02.png -
NONE/- image/g
1231260321.482150 192.168.1.20 TCP_MEM_HIT/200 739 GET
http://wp.dom.tld/wp-content/themes/default/images/icon_rss.gif - NONE/-
image/gif
1231260324.383  2 192.168.1.20 TCP_MISS/200 12 GET
http://wp.dom.tld/ping.php - FIRST_UP_PARENT/192.168.1.101 text/html
1231260326.500854 192.168.1.20 TCP_MISS/200 3209 GET
http://wp.dom.tld/?p=1 - FIRST_UP_PARENT/192.168.1.101 text/html
  


What is the output of "wget -O /dev/null -S http://wp.dom.tld/?p=1";?  
Refresh patterns only help if expiry information is absent.



1231260326.674 27 192.168.1.20 TCP_MEM_HIT/200 11252 GET
http://wp.dom.tld/wp-content/themes/default/style.css - NONE/- text/css
1231260327.406733 192.168.1.20 TCP_MEM_HIT/200 1541 GET
http://wp.dom.tld/wp-content/themes/default/images/bg_body.gif - NONE/-
image/gif
1231260327.410  3 192.168.1.20 TCP_MEM_HIT/200 8116 GET
http://wp.dom.tld/wp-content/themes/default/images/wp_blog_head_01.png -
NONE/- image/g
1231260327.411  0 192.168.1.20 TCP_MEM_HIT/200 2033 GET
http://wp.dom.tld/wp-content/themes/default/images/wp_blog_head_02.png -
NONE/- image/g
1231260327.417  6 192.168.1.20 TCP_MEM_HIT/200 739 GET
http://wp.dom.tld/wp-content/themes/default/images/icon_rss.gif - NONE/-
image/gif



# /etc/squid/squid.conf ##
# Basic parameters
visible_hostname localhost
# This line indicates the server we will be proxying for
http_port 80 defaultsite=wordpress.dom.tld
  


This should probably be...

http_port 80 accel defaultsite=wordpress.dom.tld

...to explicitly enable acceleration mode.


# And the IP Address for it
cache_peer 10.10.10.10 parent 80 0 no-query originserver
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
# Where the cache files will be, memory and such
cache_dir ufs /var/spool/squid 1 16 256
cache_mem 256 MB
maximum_object_size_in_memory 32 KB
# Log locations and format
logformat common %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %h" "%{User-Agent}>h" %Ss:%Sh
access_log /var/log/squid/access.log squid
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
hosts_file /etc/hosts
# Basic ACLs
acl all src 0.0.0.0/0.0.0.0
acl mydomain dstdomain .example.com
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 Safe_ports port 80
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access allow localhost
http_access allow all
  


Enabling http_access allow all (even in accelerator mode) is... 
inadvisable.  Removing it, and setting the mydomain ACL properly is a 
much better choice.



http_access allow mydomain
http_access deny all
http_reply_access allow all
icp_access allow all
cache_effective_group squid
coredump_dir /var/spool/squid
forwarded_for on
emulate_httpd_log on
redirect_rewrites_host_header off
buffered_logs on

refresh_pattern -i ping.php 0 0% 0 override-expire
refresh_pattern -i .php   0 50% 30
refresh_pattern -i .js0 50% 300
refresh_pattern -i .css   0 50% 300
refresh_pattern -i .jpg   0 50% 300
refresh_pattern -i .gif   0 50% 300
refresh_pattern -i .png   0 50% 300
refresh_pattern -i .swf   0 50% 300
refresh_pattern -i .html  0 50% 300
refresh_pattern -i .shtml 0 50% 300

client_persistent_connections on
server_persistent_connections on
pipeline_prefetch on
strip_query_terms off

  


Chris



[squid-users] Squid 2.6 and Wordpress

2009-01-06 Thread Dan Casey
I'm running squid 2.6 from CentOS 5 repository, as an http accelerator
for wordpress.

I've got it working to a point using a configuration I found elsewhere
(I'm not very familiar with squid yet, and most docs I've found are not
relevant to this version).
It is successfully caching the images as stuff and other static content,
but I would like it cache some of dynamic pages as well.  I've played
around with the refresh_pattern's a little bit, but didn't have any
luck.  Here is an example from the access log. 

ping.php is specifically not cached, but the other one "?p=1" I would
like to cache.

1231260321.328682 192.168.1.20 TCP_MEM_HIT/200 1541 GET
http://wp.dom.tld/wp-content/themes/default/images/bg_body.gif - NONE/-
image/gif
1231260321.331  3 192.168.1.20 TCP_MEM_HIT/200 8116 GET
http://wp.dom.tld/wp-content/themes/default/images/wp_blog_head_01.png -
NONE/- image/g
1231260321.332  0 192.168.1.20 TCP_MEM_HIT/200 2033 GET
http://wp.dom.tld/wp-content/themes/default/images/wp_blog_head_02.png -
NONE/- image/g
1231260321.482150 192.168.1.20 TCP_MEM_HIT/200 739 GET
http://wp.dom.tld/wp-content/themes/default/images/icon_rss.gif - NONE/-
image/gif
1231260324.383  2 192.168.1.20 TCP_MISS/200 12 GET
http://wp.dom.tld/ping.php - FIRST_UP_PARENT/192.168.1.101 text/html
1231260326.500854 192.168.1.20 TCP_MISS/200 3209 GET
http://wp.dom.tld/?p=1 - FIRST_UP_PARENT/192.168.1.101 text/html
1231260326.674 27 192.168.1.20 TCP_MEM_HIT/200 11252 GET
http://wp.dom.tld/wp-content/themes/default/style.css - NONE/- text/css
1231260327.406733 192.168.1.20 TCP_MEM_HIT/200 1541 GET
http://wp.dom.tld/wp-content/themes/default/images/bg_body.gif - NONE/-
image/gif
1231260327.410  3 192.168.1.20 TCP_MEM_HIT/200 8116 GET
http://wp.dom.tld/wp-content/themes/default/images/wp_blog_head_01.png -
NONE/- image/g
1231260327.411  0 192.168.1.20 TCP_MEM_HIT/200 2033 GET
http://wp.dom.tld/wp-content/themes/default/images/wp_blog_head_02.png -
NONE/- image/g
1231260327.417  6 192.168.1.20 TCP_MEM_HIT/200 739 GET
http://wp.dom.tld/wp-content/themes/default/images/icon_rss.gif - NONE/-
image/gif



# /etc/squid/squid.conf ##
# Basic parameters
visible_hostname localhost
# This line indicates the server we will be proxying for
http_port 80 defaultsite=wordpress.dom.tld
# And the IP Address for it
cache_peer 10.10.10.10 parent 80 0 no-query originserver
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
# Where the cache files will be, memory and such
cache_dir ufs /var/spool/squid 1 16 256
cache_mem 256 MB
maximum_object_size_in_memory 32 KB
# Log locations and format
logformat common %>a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %a %ui %un [%tl] "%rm %ru HTTP/%rv" %Hs %h" "%{User-Agent}>h" %Ss:%Sh
access_log /var/log/squid/access.log squid
cache_log /var/log/squid/cache.log
cache_store_log /var/log/squid/store.log
hosts_file /etc/hosts
# Basic ACLs
acl all src 0.0.0.0/0.0.0.0
acl mydomain dstdomain .example.com
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 Safe_ports port 80
acl purge method PURGE
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access allow purge localhost
http_access deny purge
http_access deny !Safe_ports
http_access allow localhost
http_access allow all
http_access allow mydomain
http_access deny all
http_reply_access allow all
icp_access allow all
cache_effective_group squid
coredump_dir /var/spool/squid
forwarded_for on
emulate_httpd_log on
redirect_rewrites_host_header off
buffered_logs on

refresh_pattern -i ping.php 0 0% 0 override-expire
refresh_pattern -i .php   0 50% 30
refresh_pattern -i .js0 50% 300
refresh_pattern -i .css   0 50% 300
refresh_pattern -i .jpg   0 50% 300
refresh_pattern -i .gif   0 50% 300
refresh_pattern -i .png   0 50% 300
refresh_pattern -i .swf   0 50% 300
refresh_pattern -i .html  0 50% 300
refresh_pattern -i .shtml 0 50% 300

client_persistent_connections on
server_persistent_connections on
pipeline_prefetch on
strip_query_terms off