Why is Squid failing to start?

akromyk
akromyk used Ask the Experts™
on
-I just installed Squid to watch Hulu on my PS3 since the site apparently blocks the PS3 browser now:

http://www.ps3news.com/PS3-Online/guide-how-to-enable-hulu-on-ps3-with-a-workaround/

-So I installed Squid using (BTW, I'm running Ubuntu 9.04):

"sudo apt-get install squid"

-And it seemed to install perfectly. Then I overwrote "/etc/squid/squid.conf" with the following code:

# squid conf to rewrite the User-Agent header.

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
acl localnet src 192.168.0.0/16 # MODIFY THIS LINE WITH YOUR LOCAL NET
acl SSL_ports port 443
acl SSL_ports port 563
acl SSL_ports port 873
acl Safe_ports port 80
acl Safe_ports port 21
acl Safe_ports port 443
acl Safe_ports port 70
acl Safe_ports port 210
acl Safe_ports port 1025-65535
acl Safe_ports port 280
acl Safe_ports port 488
acl Safe_ports port 591
acl Safe_ports port 777
acl Safe_ports port 631
acl Safe_ports port 873
acl Safe_ports port 901
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 deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access deny all
icp_access allow localnet
icp_access deny all
http_port 3128
hierarchy_stoplist cgi-bin ?
access_log /var/log/squid/access.log squid
refresh_pattern ^ftp:            144020%      10080
refresh_pattern ^gopher:      1440200%      1440
refresh_pattern -i (/cgi-bin/|\?) 00%      0
refresh_pattern (Release|Package(.gz)*)$      0020%      2880
refresh_pattern .            0020%      4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY\s[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
extension_methods REPORT MERGE MKACTIVITY CHECKOUT
header_access User-Agent deny all
header_replace User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)
hosts_file /etc/hosts
coredump_dir /var/spool/squid

-And finally, I try to start Squid with:

"sudo /etc/init.d/squid start"

-And the terminal spits back the following at me:

 * Starting Squid HTTP proxy squid
FATAL: Bungled squid.conf line 40: refresh_pattern ^ftp:            144020%10080
Squid Cache (Version 2.7.STABLE3): Terminated abnormally.
                                                                         [fail]

-Any ideas what is going wrong and/or how to fix it? I am both a Linux and Squid novice, so I don't even know where to begin looking.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
It appears you're missing some spaces or tabs on these lines:
ex: 144020%  s/b 1440<tab>20%


refresh_pattern ^ftp:            1440 20%      10080
refresh_pattern ^gopher:      1440 200%      1440
refresh_pattern -i (/cgi-bin/|\?) 0 0%      0
refresh_pattern (Release|Package(.gz)*)$      0 20%      2880
refresh_pattern .            0 20%      4320

Author

Commented:
Your solution works perfectly. Prior to your posting I got it running by removing the following lines, and it still worked with my PS3 and Hulu. Do you have any idea what the following lines are for?

refresh_pattern ^ftp:            1440 20%      10080
refresh_pattern ^gopher:      1440 200%      1440
refresh_pattern -i (/cgi-bin/|\?) 0 0%      0
refresh_pattern (Release|Package(.gz)*)$      0 20%      2880
refresh_pattern .            0 20%      4320
acl shoutcast rep_header X-HTTP09-First-Line ^ICY\s[0-9]
upgrade_http0.9 deny shoutcast
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
extension_methods REPORT MERGE MKACTIVITY CHECKOUT

Commented:
They are tweaks to make squid work better for urls with ftp: gopher: and cgi scripts.  Also helps with certain bugs with apache and browsers.

Author

Commented:
Thanks for the help. It fixed everything.
Try to run squid -z at first, this will prepare and create the cache directories.

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