gpt4 book ai didi

nginx - 为 webmin 配置 Nginx 反向代理

转载 作者:行者123 更新时间:2023-12-03 14:30:39 30 4
gpt4 key购买 nike

我已经有一个正在运行的 https 站点。我的以下配置适用于 webmin。除了当我登录时,网址重写了它旁边的端口号 10000,因此找不到错误服务器。任何人都可以帮我纠正这个吗?

server {

server_name webmin.example.com;
listen 443;
ssl on;
ssl_certificate /etc/webmin/miniserv.pem;
ssl_certificate_key /etc/webmin/miniserv.pem;
access_log off;
error_log off;
location /RequestDenied {
return 418;
}

location / {
proxy_pass https://127.0.0.1:10000;
proxy_redirect off;

#Proxy Settings
proxy_redirect off;
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_max_temp_file_size 0;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 128k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
}
}

最佳答案

更换 proxy_set_header Host $host;符合proxy_set_header Host $host:$server_port;重定向没有端口号的链接。

server {
server_name webmin.example.com;
listen 443;
ssl on;
ssl_certificate /etc/webmin/miniserv.pem;
ssl_certificate_key /etc/webmin/miniserv.pem;
access_log off;
error_log off;

location /RequestDenied {
return 418;
}

location / {
proxy_pass https://127.0.0.1:10000;
proxy_redirect off;

#Proxy Settings
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_max_temp_file_size 0;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 128k;
proxy_buffers 32 32k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
}
}

关于nginx - 为 webmin 配置 Nginx 反向代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22608942/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com