VPS上安裝Squid代理程式(支援IPv6)指南

內容 魷魚是什麼? VPS 上安裝支援 IPv6 的 Squid Proxy 的手動指南。 開始配置 Squid 代理 創建用戶 配置瀏覽器使用代理程式。 本文將指導您如何在 VPS 上手動安裝支援 IPv6 的 Squid Proxy。如果您需要協助,請透過熱線 1900 6046 轉 3、電子郵件 support@vinahost.vn 或造訪 https://livechat.vinahost.vn/chat.php 與 VinaHost 進行線上聊天聯絡。 魷魚是什麼? Squid是一款功能齊全的 Web 代理伺服器應用程序,可為HTTP、FTP和其他常見網路協定提供代理和快取服務。 Squid 可以實現安全通訊端層 (SSL) 請求的快取和代理,以及網域名稱伺服器 ( DNS )查詢快取和透明快取。 Squid 也支援多種快取協議,例如 Internet 快取協定 ( ICP )、超文本快取協定 ( HTCP )、快取陣列路由協定 ( CARP ) 和 Web 快取協調協定 ( WCCP )。本文將指導您如何在Ubuntu 20.04上安裝支援IPv6的 Squid 代理,並設定其以使用Firefox瀏覽器進行連線。 如果您還沒有 VPS,請在此處查看 Vinhahost 的 VPS 套件:VPS SSD。 VPS 上安裝支援 IPv6 的 Squid Proxy 的手動指南。 Squid軟體包可在Ubuntu 20.04軟體倉庫中找到。要安裝它,您可以執行以下命令: sudo apt update sudo apt install squid apache2-utils -y 安裝成功後,Squid將自動運作。您可以使用以下命令檢查Squid是否正常運作: sudo systemctl status squid 如果 Squid 代理程式未運行,您可以啟用Squid並再次檢查其狀態。 sudo systemctl start squid 請使用以下命令檢查您的 VPS 是否已啟用IPv6 : ip addr show 如上圖所示,我的VPS上的IPv6位址是:2001:df7:7e80:100:9f2b:1d15:19eb:7a18 我們將使用此 IP 位址來配置 Squid 代理程式。 開始配置 Squid 代理 可以透過編輯位於下列路徑的檔案來設定 Squid 服務:/etc/squid/squid.conf 在進行任何更改之前,我建議您備份原始設定檔。 sudo cp /etc/squid/squid.conf{,.default} 要開始設定 Squid,請使用您喜歡的文字編輯器開啟設定檔;在本例中,我使用的是nano 編輯器。 nano /etc/squid/squid.conf 開啟檔案後,將以下設定碼複製並貼上到檔案開頭並儲存。 ## Authentication auth_param basic program /usr/lib/squid3/basic_ncsa_auth /etc/squid/passwd auth_param basic children 5 auth_param basic realm Squid proxy-caching web server auth_param basic credentialsttl 2 hours acl password proxy_auth REQUIRED http_access allow password http_access deny all forwarded_for off ### Allow request header request_header_access Allow allow all request_header_access Authorization allow all request_header_access WWW-Authenticate 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 預設情況下,Squid 監聽伺服器上所有介面的3128 連接埠。如果您想更改連接埠並設定監聽的接口,請開啟 `/etc/squid/squid.conf` 文件,編輯`http_port 3128`行,並指定介面的 IP 位址和連接埠。如果 Squid 中未指定接口,它將監聽所有接口。 例如,將預設連接埠變更為 3333,並監聽 IP 位址 103.126.161.10。 # Squid normally listens to port 3128 http_port 103.126.161.10:3333 接下來,將下列設定新增至/etc/squid/squid.conf檔案中,使 Squid 成為 IPv6 代理程式。 acl proxy_ipv6 myip 2001:df7:7e80:100:9f2b:1d15:19eb:7a18 tcp_outgoing_address 103.126.161.10 proxy_ipv6 注意:請將 IPv6 和 IPv4 位址變更為您要安裝的 VPS 的 IP 位址。 編輯完設定檔後,需要重新啟動 Squid 才能使新設定生效。 sudo systemctl restart squid 接下來,我們先建立一個要連線的使用者。 創建用戶 在創建使用者之前,我們會建立一個包含身份驗證資訊的檔案。 touch /etc/squid/passwd 接下來,我們使用以下命令建立一個使用者: sudo htpasswd -b -m /etc/squid/passwd vinahost Password 若要更新目前使用者的密碼,請執行: sudo htpasswd /etc/squid/passwd vinahost 將vinahost和Password替換為您要設定的使用者名稱和密碼。 如果您使用了防火牆,則需要開放連接埠以允許來自外部的連線。例如,使用 Ubuntu 的 UFW 防火牆: sudo ufw allow 3333/tcp sudo ufw reload 配置瀏覽器使用代理程式。 以下說明使用 Firefox 瀏覽器建立連線。 以下步驟適用於不同的作業系統,例如:Windows、MacOS、Linux。 步驟 1:在右上角,點選有三條水平線的圖示 ☰ 開啟Firefox瀏覽器選單。 步驟 2:點選⚙「偏好設定」。 步驟 3:向下捲動至「網路設定」部分,然後按一下「設定」按鈕。 第四步:將打開一扇窗戶。 選擇「手動代理配置」選項,在「HTTP 連接埠」欄位中輸​​入 Squid 代理程式的 IP 位址,在「連接埠」欄位中輸​​入 3333。勾選「對所有協定使用此代理伺服器」複選框,然後按一下「確定」儲存設定。 接下來,請輸入您的使用者名稱和密碼進行驗證。 https://blog.vinahost.vn/cai-dat-squid-proxy-voi-ipv6-tren-vps/ 若要查看結果,請造訪https://whatismyv6.com/查看您的 IPv6 位址。 我的關於如何在Ubuntu 20.04上安裝和設定Squid Proxy 的指南到此結束。 祝你好運!

留言

這個網誌中的熱門文章

DeepNude 2.0 – Deepnude AI算法一键脱衣,绿色破解版,免费下载

我们通过视频自拍,在视频自拍 Facebook 上查看https://fbm.red/video-selfie/

用数字货币洗钱,警察蜀黍就没招了吗?| 浅黑笔记