-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTPS化 作業MEMO #48
Comments
作業ログ
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
自己署名証明書を作成(ローカル環境向け)
ローカルで HTTPS を動作させる場合、自己署名証明書を作成して nginx に設定するのが簡単。
Step 1: SSL証明書を作成
まず、自己署名証明書を作成します。
sudo mkdir -p /etc/nginx/ssl
cd /etc/nginx/ssl
自己署名証明書期限 365日の場合
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout nginx-selfsigned.key -out nginx-selfsigned.crt
自己署名証明書期限 3年(1095日)の場合
sudo openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -keyout nginx-selfsigned.key -out nginx-selfsigned.crt
入力時のポイント
Step 2: nginx の設定を変更
sudo nano /etc/nginx/sites-available/default
unvtportable0x.local の 0x には適宜ホスト名に修正(3行目と19行目の2箇所にある)
Step 3: NGINX の再起動
sudo systemctl restart nginx
Step 4: ブラウザで HTTPS にアクセス
https://unvtportable0x.local
⚠ 自己署名証明書なので、ブラウザで「この接続は安全ではありません」と表示される
→ 詳細設定 → 例外を追加して続行 でアクセス可能。
The text was updated successfully, but these errors were encountered: