proxyのありがたさを感じてきた。
- DBサーバーのようにネットに直接接続できないサーバーでもproxyサーバー経由でネットにアクセスできる。
- ネットにさらしていないので安心。
- ユーザーごとにネット接続が可/不可が可能。
そのままだとネットにアクセス出来ない環境ですが・・・
$ wget http://i.gzn.jp/images/logo.png
--2014-01-08 20:27:56-- http://i.gzn.jp/images/logo.png
Resolving i.gzn.jp (i.gzn.jp)... failed: Connection timed out.
wget: unable to resolve host address ‘i.gzn.jp’
http_proxyをセットすることでネットにアクセスできます。
$ http_proxy=http://192.168.11.23:3216/ wget http://i.gzn.jp/images/logo.png
--2014-01-08 20:28:10-- http://i.gzn.jp/images/logo.png
Connecting to 192.168.11.23:3216... connected.
Proxy request sent, awaiting response... 200 OK
Length: 5026 (4.9K) [image/png]
Saving to: ‘logo.png’
100%[==========================================================>] 5,026 --.-K/s in 0.02s
2014-01-08 20:28:10 (260 KB/s) - ‘logo.png’ saved [5026/5026]
- 認証が必要な場合は以下のように指定します。
- http_proxy=http://ユーザ名:パスワード@192.168.11.23:3216/
-
export http_proxy
しておけば、apt-getでパッケージのインストールも可能。 - httpsはhttps_proxyをセットします。