侧边栏壁纸
  • 累计撰写 208 篇文章
  • 累计创建 16 个标签
  • 累计收到 5 条评论

目 录CONTENT

文章目录

nginx反向代理url界面后,然后重定向到自己需要的页面

Wake
2022-08-15 / 0 评论 / 0 点赞 / 797 阅读 / 154 字
server {

        listen 5555 ;

        server_name localhost;

  location / {

                proxy_pass http://localhost:3000/grafana;

                rewrite  ^/(.*) http://xxx.xxx.xxx.xxx:3000/grafana permanent;

                proxy_set_header    Host             $host;#保留代理之前的host

                proxy_set_header    X-Real-IP        $remote_addr;#保留代理之前的真实客户端ip

                proxy_set_header    X-Forwarded-For  $proxy_add_x_forwarded_for;

                proxy_set_header    HTTP_X_FORWARDED_FOR $remote_addr;#在多级代理的情况下,记录每次代理之前的客户端真实ip

                proxy_set_header X-Forwarded-Proto $scheme; #表示客户端真实的协议(http还是https)

                proxy_redirect      default;#指定修改被代理服务器返回的响应头中的location头域跟refresh头域数值

        }

}
0

评论区