server {
listen 80;
#拿百度举个例子
server_name baidu.cn www.baidu.cn
# 添加重定向规则
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name www.huibebao.cn;
#证书文件的位置
ssl_certificate /root/www.baidu.cn.pem;
ssl_certificate_key /root/www.baidu.cn.key;
# SSL configuration
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
# Add other SSL related settings as needed
location / {
#改成自己程序的端口
proxy_pass http://localhost:8081; # Replace with your actual backend server details
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;
# Add other proxy settings as needed
}
}