Certbot配置https数字证书
yum -y install yum-utils
yum-config-manager --enable rhui-REGION-rhel-server-extras rhui-REGION-rhel-server-optional
yum install certbot python2-certbot-nginx
pip install urllib3
certbot --nginx
遇到 ImportError: 'pyOpenSSL' module missing required functionality. Try upgrading to v0.14 or newer.
pip install --upgrade --force-reinstall 'requests==2.6.0'
Nginx配置文件:
server { listen 443 ssl; server_name rov-lab.top www.rov-lab.top; ssl_certificate /etc/letsencrypt/live/rov-lab.top/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/rov-lab.top/privkey.pem; #charset koi8-r; #access_log logs/host.access.log main; location /api { proxy_pass http://127.0.0.1:8080/api; } location / { root /root/html/; index index.html index.htm; try_files $uri $uri/ /index.html; } } server { listen 80; server_name rov-lab.top www.rov-lab.top; rewrite ^(.*)$ https://$server_name$1 permanent; }