LoginSignup
0
0

More than 3 years have passed since last update.

ConohaのVPSからAmazon LightSailにサーバを移動③

Last updated at Posted at 2021-01-11

ConohaのVPSからAmazon LightSailにサーバを移動③

前回までのあらすじ

ぼく「とりあえず、SSHで乗り込めるまでやった」
ぼく「今どきWebサーバってhttpsやし、LetsEncryptでさくっと証明書GETしよう」
ぼく「ついでにメールもTLSや」

目次

  1. LetsEncryptで証明書を貰う
  2. HTTPSサーバでホームページ立てる
  3. MX(SMTP)サーバ立てる
  4. POPサーバ立てる
  5. 参考文献

LetsEncryptで証明書を貰う

  • Let'sEncryptで有効なDN証明書をGETする: 参考
    • nginxのインストール: amazon-linux-extras install nginx1
    • CertBotのインストール(letsencrypt) 参考: yum install certbot
    • あとはcertbot certonly -a webroot --webroot-path=/var/www -d <ドメイン名> -n --agree-tos --email ...@....com が成功するまでもっていってcronで毎月リフレッシュさせればOK。

HTTPSサーバでホームページ立てる

  • 僕の場合は自分の*.github.ioからHTMLクローンしてnginxのlocationを指定するだけ。
    • HTTP用でletsencryptの.well-knownフォルダを作ってる場合は.gitignoreで指定する。
    • Amazon LightSailのファイアウォールでHTTPSを許可する。

MX(SMTP)サーバ立てる

  • とりあえず、MTA同士の通信をなるべく暗号化: 参考
  • 多分、もう既にpostfix入ってるので、smtpとsmtpsとsubmissionをmain.cfで有効化してちゃちゃっとTLS
    • Amazon LightSailのファイアウォールでTCP25,TCP465,TCP587を許可する。
    • ハマった点:Conohaと違い、AWSはアウトバウント25番通信を禁止にしている。relayhostを$mydomain:587に変更して解決(さらばレガシー25番通信サーバ・・・)

POPサーバ立てる

  • 普通にインストール: yum install dovecot
    • Amazon LightSailのファイアウォールでTCP993,TCP995を許可する。
  • これもちゃちゃっとTLS。SASLハンドラ適当に作って終わり。ハマった点特になし。

参考文献

0
0
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
0
0