nginx版本:1.21.1
证书获取阿里云:_xxxx.xxxxx.com.pem、_xxxx.xxxxx.key
域名:xxxx.xxxxx.com
一、ssl 443端口
二、非443端口
nginx.conf
server { # 监听端口,切记,12000 后面必须加ssl listen 12000 ssl; # 域名 server_name xxxx.xxxxx.top; # 证书的以及其全路径 ssl_certificate /etc/nginx/conf/cert/_xxxx.xxxxx.com.pem; ssl_certificate_key /etc/nginx/conf/cert/_xxxx.xxxxx.key; # 可以参考官网配置 ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; # 指定密码为openssl支持的格式 ssl_protocols SSLv2 SSLv3 TLSv1.2; # 密码加密方式,可以采取默认 ssl_ciphers HIGH:!aNULL:!MD5; # 依赖SSLv3和TLSv1协议的服务器密码将优先于客户端密码 ssl_prefer_server_ciphers on; #利用error_page命令将497、301状态码的链接重定向到https://xxxx.xxxxx.top这个域名上 error_page 497 301 https://$http_host$request_uri; ...... }
nginx的error_page状态码说明:
497 - normal request was sent to HTTPS 解释:当网站只允许https访问时,当用http访问时nginx会报出497错误码
参考文档:Module ngx_http_core_module
以上转自: https://blog.csdn.net/wngpenghao/article/details/120758069
修改
docker : /etc/nginx/config.d/default.conf
标签:xxxx,ssl,nginx,Nginx,https,docker,497,xxxxx From: https://www.cnblogs.com/lshan/p/17828550.html