linux中squid stunnelProxy 伺服器安裝配置教程

來源:互聯網
上載者:User


Proxy 伺服器,就不用介紹了,簡單說一下安裝過程。開始的時候在hosting24上面,安裝,怎麼安裝都沒有成功,換成linode,半個小時就搞定了,猜測hosting24對代理做了限制。

一,伺服器說明

一台國外的vps(推薦linode),服務端squid

一台公司內部的PC機,能訪問外網就行,用戶端stunnel
要達到的目的,公司內部人員,串連公司內部的pc機,通過stunnel通道串連遠端squid,上外網查資料,Google,眾裡尋你千百度,驀然回首你卻在高牆外頭。唉。

二,服務端安裝squid

1,安裝squid

# yum install squid openssl openssl-devel 

2,產生加密代理認證
 
# cd /etc/squid 
# openssl req -new > tank.csr    //要求輸入密碼和確認密碼 
# openssl rsa -in privkey.pem -out tank.key  //輸入上面輸入的密碼 
# openssl x509 -in tank.csr -out tank.crt -req -signkey tank.key -days 3650 

3,配置squid
 
# vim /etc/squid/squid.conf 
 
acl OverConnLimit maxconn 10   //限制每個IP最大允許10個串連,防止攻擊 
minimum_object_size 1 KB      //允午最小檔案請求體大小 
maximum_object_size 1 MB      //允午最大檔案請求體大小 
cache_swap_low 10             //最小允許使用swap 10% 
cache_swap_high 25            //最大允許使用swap 25% 
cache_mem 300 MB              //可使用記憶體 
 
/*****************上面是新增,下面是修改************************/ 
 
cache_dir ufs /var/spool/squid 2048 16 256        //2048儲存空間大小,一級目錄16個,二級256個 
https_port 4430 cert=/etc/squid/tank.crt key=/etc/squid/tank.key   //連接埠可自訂 
http_access allow all 
vps硬碟,記憶體都不富裕,所以對squid所佔用的記憶體和硬碟等要加以控制。

4,啟動squid,並查看

# /etc/init.d/squid start 
 
# ps aux |grep squid 
root     15984  0.0  0.0 103256   844 pts/0    S+   17:31   0:00 grep squid 
root     16585  0.0  0.0  72484  4176 ?        Ss   15:27   0:00 squid -f /etc/squid/squid.conf 
squid    16587  0.0  0.3  93064 29468 ?        S    15:27   0:03 (squid) -f /etc/squid/squid.conf 
squid    16589  0.0  0.0  48632  2100 ?        S    15:27   0:00 (ncsa_auth) /etc/squid/passwd 
squid    16590  0.0  0.0  48632  1788 ?        S    15:27   0:00 (ncsa_auth) /etc/squid/passwd 
squid    16591  0.0  0.0  48632  1784 ?        S    15:27   0:00 (ncsa_auth) /etc/squid/passwd 
squid    16592  0.0  0.0  48632  1788 ?        S    15:27   0:00 (ncsa_auth) /etc/squid/passwd 
squid    16593  0.0  0.0  48632  1784 ?        S    15:27   0:00 (ncsa_auth) /etc/squid/passwd 
squid    16594  0.0  0.0  20084  1112 ?        S    15:27   0:00 (unlinkd) 

VPS很少有,自啟動開啟防火牆的,如果有先關掉,等都配置好了,在開放連接埠。

三,用戶端安裝配置stunnel

1,安裝
# yum install stunnel 
2,新增配置/etc/stunnel/stunnel.conf,添加以下內空
client = yes 
[https] 
accept = 7071 
connect = 外網VPS的IP:4430
 
3,啟動stunnel並查看
 
# stunnel            //啟動,預設設定檔路徑 /etc/stunnel/stunnel.conf 
 
# ps aux |grep stunnel  //查看 
root     15972  0.0  0.0 103256   848 pts/0    S+   17:30   0:00 grep stunnel 
root     21099  0.0  0.0  41532  1060 pts/0    S    15:42   0:00 stunnel 
root     21100  0.0  0.0  41532  1060 pts/0    S    15:42   0:00 stunnel 
root     21101  0.0  0.0  41532  1060 pts/0    S    15:42   0:00 stunnel 
root     21102  0.0  0.0  41532  1060 pts/0    S    15:42   0:00 stunnel 
root     21103  0.0  0.0  41532  1060 pts/0    S    15:42   0:00 stunnel 
root     21104  0.0  0.0 2077984 6824 ?        Ss   15:42   0:00 stunnel
 
到這兒就安裝好了,設定瀏覽器代理,填寫區域網路IP和連接埠,就可以訪問外網了,這樣不太安全,如果能加上使用者認證會,安全一點

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.