如何在Ubuntu 20.04 LTS上安装Squid Proxy
admin
2023-07-31 07:01:48
0次

Squid-cacheSquid-cache在Ubuntu 20.04 LTS Focal Fossa上安装Squid Proxy

步骤1.首先,通过apt在终端中运行以下命令来确保所有系统软件包都是最新的。

sudo apt update
sudo apt upgrade

第2步。在Ubuntu 20.04上安装Squid Proxy。

可以从Ubuntu存储库中获得squid代理程序包。要安装它,请运行以下命令:

sudo apt install squid

安装完成后,Squid服务将自动启动。要进行验证,请检查服务状态:

sudo systemctl status squid

步骤3.配置Squid代理。

要开始配置您的鱿鱼实例,请在您喜欢的文本编辑器中打开文件:

sudo nano /etc/squid/squid.conf
# Recommended minimum configuration:
auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid/squid_passwd
acl ncsa_users proxy_auth REQUIRED
http_access allow ncsa_users

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 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 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 SSL_ports port 9001           # webmin
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 deny all
http_port 3128

forwarded_for off

request_header_access Allow allow all
request_header_access Authorization allow all
request_header_access Proxy-Authorization allow all
request_header_access Proxy-Authenticate allow all
request_header_access Cache-Control allow all
request_header_access Content-Encoding allow all
request_header_access Content-Length allow all
request_header_access Content-Type allow all
request_header_access Date allow all
request_header_access Expires allow all
request_header_access Host allow all
request_header_access If-Modified-Since allow all
request_header_access Last-Modified allow all
request_header_access Location allow all
request_header_access Pragma allow all
request_header_access Accept allow all
request_header_access Accept-Charset allow all
request_header_access Accept-Encoding allow all
request_header_access Accept-Language allow all
request_header_access Content-Language allow all
request_header_access Mime-Version allow all
request_header_access Retry-After allow all
request_header_access Title allow all
request_header_access Connection allow all
request_header_access Proxy-Connection allow all
request_header_access User-Agent allow all
request_header_access Cookie allow all
request_header_access All deny all
visible_hostname idroot.us

默认情况下,squid设置为侦听3128服务器上所有网络接口上的端口。每当您对配置文件进行更改时,都需要重新启动Squid服务以使更改生效:

sudo systemctl restart squid

步骤4.配置Squid身份验证。

现在,我们创建身份验证文件,Squid可使用该文件来验证用户身份验证:

$ htpasswd -b /etc/squid/squid_passwd username password

例子:

$ htpasswd -b -c /etc/squid/squid_passwd meilana maria

对配置文件进行更改后,保存该文件并使用在终端提示符下输入的以下命令重新启动squid服务器服务以使更改生效:

sudo systemctl restart squid

步骤5.配置防火墙。

要打开鱿鱼端口,请启用UFW的“鱿鱼”配置文件:

sudo ufw allow \'Squid\'

步骤6.在Firefox浏览器上配置代理设置。

现在已经设置了Squid,最后一步是配置您喜欢的浏览器以使用它。在Firefox上,将其配置为通过Squid服务器连接到外部网络。首选项->常规->网络设置->手动代理配置。选中对所有协议使用此代理服务器。

恭喜你!您已经成功安装了Squid。感谢您使用本教程在Ubuntu 20.04 LTS Focal Fossa上安装Squid代理服务器。有关其他帮助或有用信息,我们建议您检查Squid官方网站。

相关内容

热门资讯

Windows 11 和 10... Windows 11/10 文件夹属性中缺少共享选项卡 – 已修复 1.检查共享选项卡是否可用 右键...
事件 ID 7034:如何通过... 点击进入:ChatGPT工具插件导航大全 服务控制管理器 (SCM) 负责管理系统上运行的服务的活动...
Radmin VPN Wind... Radmin VPN 是一款免费且用户友好的软件,旨在牢固地连接计算机以创建一个有凝聚力的虚拟专用网...
Hive OS LOLMine... 目前不清退的交易所推荐: 1、全球第二大交易所OKX欧意 国区邀请链接: https://www.m...
Hive OS 新建飞行表的方... 目前不清退的交易所推荐: 1、全球第二大交易所OKX欧意 国区邀请链接: https://www.m...
如何在 Windows 11 ... 在对 Windows 注册表编辑器进行任何更改之前,强烈建议备份您的注册表设置。如果出现问题,您始终...
Hive OS 部署 PXE ... 目前不清退的交易所推荐: 1、全球第二大交易所OKX欧意 国区邀请链接: https://www.m...
如何在Instagram上扫描... 如何在Instagram上扫描名称标签/ QR? 总而言之,您可以通过大约四种不同的方法来扫描这些I...
Hive OS A卡超频VII... 目前不清退的交易所推荐: 1、全球第二大交易所OKX欧意 国区邀请链接: https://www.m...
如何修复 Steam 内容文件... Steam 内容文件锁定是当您的 Steam 文件无法自行更新时出现的错误。解决此问题的最有效方法之...