nginx 配置 https反向代理 minio 信息
nginx 配置新 代码片段
.
// An highlighted block
upstream img_test {
server 127.0.0.1:9000;
}
server {
listen 80;
server_name img.com;
# 重定向所有 HTTP 流量到 HTTPS
return 301 https://$server_name$request_uri;
#核心代码
#rewrite ^(.*)$ https://${server_name}$1 permanent;
}
server {
listen 443 ssl;
server_name img.com;
# SSL 配置
ssl_certificate /etc/nginx/cert/ img.com.pem;
ssl_certificate_key /etc/nginx/cert/ img.com.key;
#ssl_session_cache shared:SSL:1m;
#ssl_session_timeout 5m;
#自定义设置使用的TLS协议的类型以及加密套件(以下为配置示例,请您自行评估是否需要配置)
#TLS协议版本越高,HTTPS通信的安全性越高,但是相较于低版本TLS协议,高版本TLS协议对浏览器的兼容性较差。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
#表示优先使用服务端加密套件。默认开启
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/minio.access.log main;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
proxy_http_version 1.1;
proxy_connect_timeout 300;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
chunked_transfer_encoding off;
proxy_buffering off;
proxy_redirect off;
proxy_pass http://img_test;
}
}