[root@web prometheus]# yum install nginx -y
[root@web prometheus]# cat /etc/nginx/conf.d/prometheus.conf
server {
#填写绑定证书的域名
server_name xxxx.com;
listen 80;
#把http的域名请求转成https
rewrite (.*) https://$server_name$1;
}
server {
#填写绑定证书的域名
server_name xxxx.com;
#SSL 访问端口号为 443
listen 443 ssl;
#证书文件名称
ssl_certificate /etc/nginx/ssl/xxx.crt;
#私钥文件名称
ssl_certificate_key /etc/nginx/ssl/xxx.key;
ssl_session_timeout 10m;
#请按照以下协议配置
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#请按照以下套件配置,配置加密套件,写法遵循 openssl 标准。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
client_max_body_size 250m;
location / {
proxy_pass http://127.0.0.1:9090/;
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $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;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
}
}