nginx.conf
server {
listen 80;
server_name localhost;
#charset koi8-r;
# access_log /DATA/log/nginx/host.access.log main;
access_log /var/log/nginx/host.access.log main;
error_log /var/log/nginx/error.log;
ignore_invalid_headers off; #pass through headers from Jenkins which are considered invalid by Nginx server.
location /jenkins/ {
proxy_pass http://jenkins_master:8080/jenkins/;
proxy_http_version 1.1;
sendfile off;
proxy_set_header X-Forwarded-Host $host:90;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_max_temp_file_size 0;
#this is the maximum upload size
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffering off;
proxy_request_buffering off; # Required for HTTP CLI commands in Jenkins > 2.54
proxy_set_header Connection ""; # Clear for keepalive
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
docker-compose.yml
version: '3'
# Persistent volumes for Jenkins and Nginx
volumes:
jenkins_home: {}
jenkins_logs: {}
nginx_logs: {}
networks:
docker_network:
services:
jenkins:
image: jenkins/jenkins:lts
container_name: jenkins_master
environment:
JAVA_OPTS: "-Djava.awt.headless=true"
JENKINS_OPTS: --prefix=/jenkins
volumes:
- jenkins_home:/var/jenkins_home
- jenkins_logs:/var/log/jenkins
networks:
- docker_network
nginx:
image: nginx:latest
container_name: reverse_proxy
ports:
- "90:80"
- "443:443"
volumes:
- "nginx_logs:/var/log/nginx/"
networks:
- docker_network
links:
- jenkins:jenkins
depends_on:
- jenkins
从此命令开始
$docker-compose up -d --force-recreate --build
在http://localhost:90/jenkins上登录后 我总是得到这个错误 “看来您的反向代理设置已损坏。” 全局设置/詹金斯URL设置为http://localhost:90/jenkins 我在哪里弄错了,您能帮我吗?我看不到了吗?