Youtube Nginx 擴展模塊 certbot文檔html
yum -y install epel-release yum -y install certbot certbot certonly --standalone -d ajanuw.fun // 填寫郵箱 xxx@xx.com // 贊成條款 A // 是否願意與Electronic Frontier分享您的電子郵件地址 Y // 設置自動續訂 > echo「0 0,12 * * * root python -c'import random; import time; time.sleep(random.random()* 3600)'&& certbot renew」| sudo tee -a / etc / crontab> / dev / null cp -r /etc/letsencrypt/ ./ 複製一份 tar czf letsencrypt.tar.gz letsencrypt/ 壓縮一個 // vi nginx.conf 修改配置文件 // Docs: https://mozilla.github.io/server-side-tls/ssl-config-generator/
server { # listen 80; listen 443 ssl http2; listen [::]:443 ssl http2; server_name www.ajanuw.fun; ssl_certificate /etc/letsencrypt/live/ajanuw.fun/cer.pem; # ssl_certificate_key /etc/letsencrypt/live/ajanuw.fun/privkey.pem; # ssl_session_timeout 1d; ssl_session_cache shared:SSL:50m; ssl_session_tickets off; ssl_protocols TLSv1.2; ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256'; ssl_prefer_server_ciphers on; add_header Strict-Transport-Security max-age=15768000; ssl_stapling on; ssl_stapling_verify on; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } }
下面是我最新的配置python
1) 先查看下使用certbot生成的密匙linux
# ls /etc/letsencrypt/live/ajanuw.xyz/ cert.pem chain.pem dhparam.pem fullchain.pem privkey.pem README
這個dhparam.pem
是我在生成密匙後新添加的 curl https://ssl-config.mozilla.org/ffdhe2048.txt > ./dhparam.pem
nginx
2) 配置nginx.confgit
server { listen 80; listen [::]:80; server_name www.ajanuw.xyz; # redirect all HTTP requests to HTTPS with a 301 Moved Permanently response. return 301 https://www.ajanuw.xyz; } server { listen 443 ssl http2; listen [::]:443 ssl http2; ssl_certificate /etc/letsencrypt/live/ajanuw.xyz/cert.pem; ssl_certificate_key /etc/letsencrypt/live/ajanuw.xyz/privkey.pem; ssl_session_timeout 1d; ssl_session_cache shared:MozSSL:10m; ssl_session_tickets off; ssl_dhparam /etc/letsencrypt/live/ajanuw.xyz/dhparam.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; ssl_prefer_server_ciphers off; add_header Strict-Transport-Security "max-age=63072000" always; ssl_stapling on; ssl_stapling_verify on; ssl_trusted_certificate /etc/letsencrypt/live/ajanuw.xyz/fullchain.pem; // 填寫你服務器的ip resolver 127.0.0.1; location / { root html; index index.html index.htm; # proxy_pass http://127.0.0.1:3000; } #error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }