Renew
30 2 * * 1 /usr/local/sbin/certbot-auto renew >> /var/log/le-renew.log
NginxにSSl証明書を適応させる
- 証明書お生成
wget https://dl.eff.org/certbot-auto
chmod 0755 certbot-auto
./certbot-auto certonly --standalone -d domain.com
- upstreamを使って、80番に来るリクエストあ全部443にリダイレクトする.
/etc/nginx/nginx.conf
設定ファイルお編集
http {
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name mydomain.com;
# 80番に来るリクエストあ全部443にリダイレクトする
return 301 https://$host$request_uri;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
upstream cloud_storage {
server 127.0.0.1:9000;
}
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name mydomain.com;
ssl_certificate "/etc/letsencrypt/live/mydomain.com/fullchain.pem";
ssl_certificate_key "/etc/letsencrypt/live/mydomain.com/privkey.pem";
location / {
proxy_pass http://cloud_storage;
}
}
......
}