1. 程式人生 > 實用技巧 >service squid start啟動失敗:Starting squid: .................... [FAILED]

service squid start啟動失敗:Starting squid: .................... [FAILED]

問題描述:
squid配置反向代理模式後,啟動報錯:

[root@019 squid]# service squid start
Starting squid: ....................                       [FAILED]

檢查配置檔案:

http_access allow all

# Squid normally listens to port 3128
http_port 20.20.20.19:80 vhost
visible_hostname 019
cache_peer 10.10.10.18 parent 80 0 originserver round-robin
cache_peer 10.10.10.20 parent 80 0 originserver round-robin

檢視服務和監聽的埠資訊

[root@019 squid]# netstat -anpt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:5901                0.0.0.0:*                   LISTEN      2007/Xvnc           
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1665/rpcbind        
tcp        0      0 0.0.0.0:54192               0.0.0.0:*                   LISTEN      1708/rpc.statd      
tcp        0      0 0.0.0.0:6001                0.0.0.0:*                   LISTEN      2007/Xvnc           
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1905/sshd           
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      1743/cupsd          
tcp        0      0 127.0.0.1:6010              0.0.0.0:*                   LISTEN      2387/sshd           
tcp        0      0 127.0.0.1:6011              0.0.0.0:*                   LISTEN      2387/sshd           
tcp        0     64 10.10.10.19:22              10.10.10.1:57572            ESTABLISHED 2387/sshd           
tcp        0      0 :::111                      :::*                        LISTEN      1665/rpcbind        
tcp        0      0 :::80                       :::*                        LISTEN      2925/httpd    

發現80埠被httpd服務佔用

解決辦法:
關閉httpd服務,並禁止httpd服務開機自啟

[root@019 squid]# service httpd stop
Stopping httpd:                                            [  OK  ]
[root@019 squid]# chkconfig httpd off

啟動squid服務驗證:

[root@019 squid]# service squid start
Starting squid: .                                          [  OK  ]
[root@019 squid]# netstat -anpt |grep squid
tcp        0      0 20.20.20.19:80              0.0.0.0:*                   LISTEN      3054/(squid)