求教: nginx 代理 esxi 的管理页面

357 天前
 adonislau
期望的请求地址是
example.com/esxi
但是无论怎么配置,都无法成功,请各位大佬教我。
2044 次点击
所在节点    NGINX
14 条回复
littlewing
357 天前
hweining
357 天前
location /esxi/ {
adonislau
357 天前
现有配置是
location /esxi/ {
proxy_pass https://192.168.1.6/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
然后打开 example.com/esxi ,会自己跳转到 example.com/ui ,控制台的网络中显示一片红
jackyzy823
357 天前
ysc3839
357 天前
这种会跳转的应该没什么好办法,最多只能文本替换,但这么做会有很多问题,建议还是用域名来区分
wangmn
357 天前
busier
357 天前
没事不要转换路径,人家是 /你就继续 /,别转换到 /esxi!
gneko
357 天前
条件允许的话,可以考虑搞成 esxi.example.com/
xiaoyuesanshui
356 天前
我用的是,请参考

server {
#https 监听 443 端口
listen 803 ssl;
#log 文件配置
# access_log /var/log/nginx/reverse-access.log;
# error_log /var/log/nginx/reverse-error-openwrt.log;
#反向代理的域名,还可以以次作为条件,不同的域名用不同的反向代理方式,以此共享 IP ,或者负载均衡
server_name aaa.bbbb.ccc;
#https 相关配置
#证书文件路径,证书需要在相关平台申请,个人用的阿里云里面的 ssl 控制台申请的
ssl_certificate /etc/nginx/cert/nginx-cert.pem;
ssl_certificate_key /etc/nginx/cert/nginx-key.pem;
#ssl 相关的一些协议,会话等配置
ssl_session_cache shared:SSL:1m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#反向代理的连接,/为根路径,如果想以 https://hostname/server1 这种形式,则用 /server1
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
index index.php;
add_header Content-Security-Policy upgrade-insecure-requests;
#传输大小限制,不设置的话默认为 1M ,可能有 css 、图片看不到的问题
client_max_body_size 100M;
#将外部 IP 信息递交给被反向代理的服务器
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#反向代理的 http 服务
proxy_pass https://192.168.50.52;
}
}

https://aaa.bbb.ccc:803 是可以正常用 esxi 管理页的全部功能

但是 https://aaa.bbb.ccc:803/esxi 这种的,能力有限,一直没研究明白该怎么写
xiaoyuesanshui
356 天前
另外,esxi 默认配置页是 https://localhost ,注意是 https ,不像其他的 web 服务默认是 http
可能是这里出了问题

另外报错是报什么? 502 么
adonislau
356 天前
请教了公司的运维同事,也搞不定。
放弃治疗了,决定依旧使用 esxi.example.com 这种域名。
谢谢各位大佬回复。
xyjincan
356 天前
多个子域名好呀
yinmin
356 天前
@adonislau 这个需求可能是无解的。只有 web 程序原生支持自定义路径才行,例如:portainer 、code server 都是代码里特别去支持才行。
awinds
356 天前
这种会跳转的配起来很麻烦,还得在 esxi 里面配置,子域名完美解决最好

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/939331

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX