部署tinyproxy透明代理服務


線上需要一個https的透明代理,開始打算用nginx,調試了一段時間發現配置較復雜且沒有成功。后來用的tinyproxy做的透明代理。安裝配置過程就是下載、解壓、編譯、安裝、配置、啟動一波流:

安裝依賴

sudo apt-get install asciidoc

下載

sudo wget https://github.com/tinyproxy/tinyproxy/releases/download/1.8.4/tinyproxy-1.8.4.tar.gz -O tinyproxy-1.8.4.tar.gz

解壓

sudo tar xvfz tinyproxy.1.8.4.tar.gz

編譯配置

./configure --enable-transparent --prifix=/usr/local/tinyproxy
更多的編譯選項可以參考源碼目錄的README文件,部分說明如下:

```

./configure
make

make install

in the top level directory to compile and install Tinyproxy. There are
additional command line arguments you can supply to configure. They
include:

--enable-debug        If you would like to turn on full
            debugging support
--enable-xtinyproxy    Compile in support for the XTinyproxy
            header, which is sent to any web
            server in your domain.
--enable-filter        Allows Tinyproxy to filter out certain
            domains and URLs.
--enable-upstream    Enable support for proxying connections
            through another proxy server.
--enable-transparent
            Allow Tinyproxy to be used as a
            transparent proxy daemon
--enable-static        Compile a static version of Tinyproxy

    --with-stathost=HOST    Set the default name of the stats host

Support

#編譯
`sudo make`
#安裝
`sudo make install`

修改配置文件一般需要指定用戶、用戶組、端口、訪問IP段,當然這些都有默認值,然后啟動程序和測試。
```

啟動程序:

/usr/local/tinyproxy/sbin/tinyproxy -c /usr/local/tinyproxy/etc/tinyproxy.conf

測試代理節點是否生效(假設代理程序安裝在10.10.10.10的機器,監聽的是8888端口):

curl url --proxy 10.10.10.10:8888

如果是https代理加 -k 參數

curl url --proxy 10.10.10.10:8888 -k
```

關於配置文件的一點補充:
```

添加多段IP地址

Allow 10.27.80.0/24
Allow 11.65.48.0/24
Allow 18.90.12.145

添加head信息,https的代理不能添加(一條信息一條記錄和ip訪問限制設置一樣)

AddHeader "Referer" "http://www.baidu.com"


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM