我有 2 个虚拟机(VM1 和 VM2),想要构建以下基础架构:
我在访问 Jenkins 时遇到问题
我做了以下配置:
Nginx
server {
listen 80;
server_name VM1_IP;
location /jenkins {
proxy_pass http://localhost:8080;
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 X-Forwarded-Proto $scheme;
}
}
詹金斯
JENKINS_ARGS="--webroot=.... --httpPort=$HTTP_PORT --prefix=/jenkins"
詹金斯网址
http://VM1_IP/jenkins
由于某种原因,我无法访问 Jenkins,理论上,Jenkins 应该可以通过
http://VM1_IP/jenkins
访问,但它会将我重定向到登录名,并返回 404 :(
我做错了什么?
尝试添加
proxy_redirect
指令来替换任何重定向标头。
location /jenkins {
proxy_pass http://127.0.0.1:8080;
proxy_redirect http://127.0.0.1:8080/ http://VM1_IP/;
}