0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Let's Encrypt で Overleaf Toolkit を HTTPS 化した手順まとめ

Last updated at Posted at 2025-04-06

こんにちは!今回は、社内で使っている Overleaf Toolkit を Let's Encrypt を使って HTTPS 化(TLS化)した際の設定手順をまとめました :pencil:

社内運用やプライベートクラウドでも、TLSで安全にアクセスしたいですよね。本記事では、NGINXによるTLSプロキシ構成を導入し、Let's Encryptの無料SSL証明書を活用してHTTPSを実現したステップを詳しく紹介します。

:gear: 前提条件

  • Overleaf Toolkit(Community Edition)導入済み
  • ドメインがある(例:your-domain.example.com
  • そのドメインがサーバーのパブリックIPに向いている
  • bin/config/ ディレクトリがある構成になっている
  • 80番/443番ポートが空いている or 調整可能

:rocket: ステップバイステップで HTTPS 化!

1. NGINX を使った TLS プロキシ構成の初期化

bin/init --tls

これで以下のファイルが作られます:

  • config/nginx/certs/overleaf_key.pem
  • config/nginx/certs/overleaf_certificate.pem

実運用ではこれらを Let's Encrypt の本物の証明書と置き換えます。

2. Let's Encrypt の証明書を取得

Certbot をインストール(Ubuntu)

sudo apt update
sudo apt install certbot

サーバーがポート80で待ち受けていないことを確認

sudo lsof -i :80

ファイアウォールでポート80を開放

sudo ufw allow 80
sudo ufw allow 443

Certbot 実行(スタンドアロンモード)

sudo certbot certonly --standalone -d your-domain.example.com

成功すると以下に証明書が発行されます:

  • /etc/letsencrypt/live/your-domain.example.com/fullchain.pem
  • /etc/letsencrypt/live/your-domain.example.com/privkey.pem

3. 証明書ファイルを Overleaf にコピー

sudo cp /etc/letsencrypt/live/your-domain.example.com/fullchain.pem config/nginx/certs/
sudo cp /etc/letsencrypt/live/your-domain.example.com/privkey.pem config/nginx/certs/
sudo chown ddd3h:ddd3h config/nginx/certs/*.pem

4. config/overleaf.rc を編集

NGINX_ENABLED=true
NGINX_HTTP_PORT=80
TLS_PORT=443
NGINX_HTTP_LISTEN_IP=0.0.0.0
NGINX_TLS_LISTEN_IP=0.0.0.0
TLS_CERTIFICATE_PATH=config/nginx/certs/fullchain.pem
TLS_PRIVATE_KEY_PATH=config/nginx/certs/privkey.pem
OVERLEAF_PORT=8081  # ポートバッティング回避のため変更

5. .env 設定(HTTPS対応)

OVERLEAF_BEHIND_PROXY=true
OVERLEAF_SECURE_COOKIE=true

6. lib/docker-compose.base.yml の確認

services:
  sharelatex:
    ports:
      - "${OVERLEAF_LISTEN_IP:-127.0.0.1}:${OVERLEAF_PORT:-8081}:80"

ポート80バインドを避けるため、環境変数で OVERLEAF_PORT=8081 を設定しています。

7. 起動確認

bin/down
bin/up

もしくは、本番運用では以下がおすすめ:

bin/stop
bin/start

:mag: 確認するポイント

  • https://your-domain.example.com にアクセスできるか
  • 自己署名証明書ではなく、Let's Encrypt の本物の証明書が使われているか
  • NGINX がフロントで HTTPS を受け、内部は HTTP になっている構成か

:repeat: 証明書の自動更新への対応

Let's Encrypt は90日ごとに更新が必要です。自動更新後、証明書を Overleaf ディレクトリに再コピー&サービス再起動するように、--deploy-hook でスクリプトを組むのがおすすめです。

:tada: おわりに

これで Overleaf Toolkit を安全に HTTPS 化することができました!
今回の構成は個人用途〜小規模社内ツールでの運用にピッタリです。

今後は Overleaf 上のプライベートプロジェクトも安心して使えるようになりますね :pencil:

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?