RoCry - V1
type: channel
link: https://www.rocry.cn/tag/V1/
items: 哪吒面板V1宝塔面板反向代设置

哪吒面板V1宝塔面板反向代设置
type: item
date: 2024-12-09T11:41:00+08:00
description: 折腾3小时，查了半天google百度都没找到，还是得子给自足！官网的wiki只是给了大概的，发现后台进不去，只能用定向的8008端口，然后反向代理及其不好用，我还是没有加TLS 连接！还是得分享给需要的人吧!修改主配置文件，添加至最底部！# upstream 配置 upstream dashboard { keepalive 512; server 127.0.0.1:8008; }新建一个反向代理(或者修改宝塔的反向代理配置)，并编辑修改配置文件保存#PROXY-START/ location ^~ / { proxy_pass http://127.0.0.1:8008; # 改成自己的端口 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 REMOTE-HOST $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header nz-realip $remote_addr; proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-Proto $scheme; proxy_http_version 1.1; proxy_read_timeout 3600s; proxy_send_timeout 3600s; proxy_buffer_size 128k; proxy_buffers 4 128k; proxy_busy_buffers_size 256k; proxy_max_temp_file_size 0; add_header X-Cache $upstream_cache_status; add_header Cache-Control no-cache; proxy_ssl_server_name off; proxy_ssl_name $proxy_host; add_header Strict-Transport-Security "max-age=31536000"; } underscores_in_headers on; set_real_ip_from 0.0.0.0/0; # CDN 回源 IP 地址段 # gRPC 服务 location ^~ /proto.NezhaService/ { grpc_set_header Host $host; grpc_set_header nz-realip $remote_addr; grpc_read_timeout 600s; grpc_send_timeout 600s; grpc_socket_keepalive on; client_max_body_size 10m; grpc_buffer_size 4m; grpc_pass grpc://dashboard; } # WebSocket 服务 location ~* ^/api/v1/ws/(server|terminal|file)(.*)$ { proxy_set_header Host $host; proxy_set_header nz-realip $remote_addr; proxy_set_header Origin https://$host; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_read_timeout 3600s; proxy_send_timeout 3600s; proxy_pass http://127.0.0.1:8008; # 改成自己的端口 } #PROXY-END/这个是直接使用Nginx 自带反向代理配置文件添加，如果需要加CDN，请参考wiki内的反向代理教程修改成自己的内容！