LoginSignup
8
3

More than 1 year has passed since last update.

Lightsailでプロキシサーバーを立てる

Last updated at Posted at 2021-09-18

はじめに

Amazon LightsailのUbuntuでBasic認証ありのプロキシサーバーを構築していきます。

環境

Ubuntu 18.04 LTS

手順

①パッケージリストの更新

$ sudo apt-get update

②squidのインストール

$ sudo apt install squid

③Basic認証のためにapache2-utilsをインストール

$ sudo apt install apache2-utils

④Basic認証のためのユーザーの作成

$ sudo htpasswd -c /etc/squid/.htpasswd username #usernameは自分で決めてください
New password:   #パスワードを決めて入力
Re-type new password:

⑤990行目あたりのacl CONNECT method CONNECTより下に設定を追記

$ sudo vi /etc/squid/squid.conf
acl CONNECT method CONNECT #この記述は既にあります

auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/.htpasswd
auth_param basic children 3
auth_param basic realm Proxy Authentication
auth_param basic credentialsttl 24 hours
acl basic_user proxy_auth REQUIRED
http_access allow basic_user

⑥Squidを起動する

$ sudo systemctl start squid

その他

  1. LightsailがUbuntu20.04だと動かない可能性があります。
  2. ポートを変えたい場合は1620行目のhttp_portを任意のポート番号にする。(デフォルトは3128)
8
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
3