我有一个公众面对jenkins,我想用nginx / fail2ban保护。 nginx反向代理很有效,直到我在nginx中打开基本身份验证。当我激活nginx基本身份验证时,jenkins会出现500内部服务器错误。
nginx config:
location /jenkins/ {
auth_basic "Development";
auth_basic_user_file /etc/nginx/.htpasswd;
rewrite ^/jenkins(/.*)$ $1 break;
proxy_pass http://127.0.0.1:8080$request_uri;
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;
proxy_set_header X-Forwarded-User $remote_user;
proxy_redirect http://127.0.0.1:8080 $scheme://xxxxx.com.au;
}
nginx访问日志:
XXX.XX.XX.XXX - mark [04/Jun/2017:12:01:35 +1000] "GET /jenkins/login?from=%2Fjenkins%2F HTTP/1.1" 500 595 "https://xxxxx.com.au/jenkins/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" "-"
一些值得注意的位: