Nginx转发设置模板

连祈
2024-11-04 / 0 评论 / 8 阅读 / 正在检测是否收录...
#80
server {
    listen 80;
 #   server_name your_domain.com;  # 替换为你的域名或 IP 地址
    return 301 https://$host$request_uri;
    location / {
        proxy_pass http://localhost:10;  # 转发到 18000 端口
        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;
    }
}
#443
server {
    listen 443 ssl;
 #   server_name your_domain.com;  # 替换为你的域名或 IP 地址

    ssl_certificate /path/to/your/certificate.crt;   # 替换为你的 SSL 证书路径
    ssl_certificate_key /path/to/your/private.key;    # 替换为你的 SSL 私钥路径

    location / {
        proxy_pass https://localhost:14;  # 转发到 14430 端口
        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;
    }
}
0

评论 (0)

取消