Squid 仅在使用“sudo”运行时才有效

Squid 仅在使用“sudo”运行时才有效

我想运行可能的squid代理实例。但只有当鱿鱼用 sudo 启动时我才能与它们连接。在鱿鱼配置中我有:

access_log none
cache_store_log none
cache_log /dev/null
$ squid -n squida -f /tmp/squid_80fm8klt.conf                                                                                                              
$ curl --proxy http://localhost:3129  https://httpbin.org/ip                                                                                                   
curl: (7) Failed to connect to localhost port 3129: Connection refused
$ sudo squid -n squida -f /tmp/squid_80fm8klt.conf                                                                                                         
WARNING: Cannot write log file: none
none: Permission denied
         messages will be sent to 'stderr'.
$ curl --proxy http://localhost:3129  https://httpbin.org/ip                                                                                                     
{
  "origin": "92.119.18.XX"
}

我使用的是 Fedora 32 系统。

完整配置:

http_access allow all

coredump_dir /var/spool/squid3

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

access_log none
cache_store_log none
cache_log /dev/null

never_direct allow all
cache_peer zzz.nordvpn.com parent 89 3130 tls login=xXx:yYy
http_port 3129

答案1

正如 @muru 所提到的,运行鱿鱼squid -N -d 1表明

2021/07/27 03:20:12| FATAL: failed to open /run/squid.pid: (13) Permission denied
    exception location: File.cc(190) open

解决方案是将 pidfile 放在另一个目录中,或者避免创建它,按照http://www.squid-cache.org/Doc/config/pid_filename/ 将其放入配置中:

pid_filename none

相关内容