和nginx配合使用,隐藏真实访问地址 #142
wangdaye078
started this conversation in
General
Replies: 1 comment
-
首先使用域名肯定是可以的,可以参考 https://github.com/zdz/ServerStatus-Rust#6-faq 如何使用自定义主题 和这里 #37 把需要的路由 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
server的开放端口默认是8080,如果放在外网,端口扫描后很容易被别人看到数据。所以我再前面先装了个nginx,增加配置
location ^~ /vnstat/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080/;
}
location ^~ /static/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8080/static/;
}
然后就可以在防火墙上禁止外网访问8080端口,改用http://www.xyz.com/vnstat来访问。
相应的stat_client.service需要修改http://127.0.0.1:8080/report为http://78.78.78.78/vnstat/report,似乎不支持域名,所以得填IP地址。
Beta Was this translation helpful? Give feedback.
All reactions