【问题标题】:Jenkins + nginx reverse proxy on PleskPlesk 上的 Jenkins + nginx 反向代理
【发布时间】:2020-07-11 08:09:00
【问题描述】:

我在我的 centOS 服务器上运行 Plesk Obsidian,并在其上手动安装了 Jenkins。詹金斯已启动并运行。它可以通过调用http://my-server.de:38080 来使用,没有任何问题。我还在 Plesk (jenkins.my-server.de) 中创建了一个新的子域,该子域使用 let encrypt 证书进行保护。

我的想法是使用 nginx 反向代理使用新的子域调用 Jenkins:https://jenkins.my-server.de。因此,我在子域的 Plesk Apache 和 nginx 设置中禁用了 Apache 的使用,并在 Plesk Web 界面中添加了以下额外的 nginx 指令:

location ~ / {
  proxy_pass          http://localhost:38080;
  proxy_read_timeout  90;

  proxy_redirect      http://localhost:38080 https://jenkins.my-server.de;
}

问题是,一些网站正在运行,而在其他网站上我得到了 404。

调用https://jenkins.my-server.de 应该会显示登录页面,但我得到一个404。只有在浏览器中输入https://jenkins.my-server.de/index 时,我才能看到登录页面。 另一方面,调用 https://jenkins.my-server.de/manage 会加载所需页面而不会出错。 https://jenkins.my-server.de/configureSecurity 页面再次显示 404,并且仅在我在末尾添加 /index 时才有效。

我是否在 nginx 设置中遗漏了什么?

【问题讨论】:

    标签: nginx jenkins http-status-code-404 reverse-proxy plesk


    【解决方案1】:

    以下配置适用于我与 Plesk 的结合。

    location ^~ / {
        proxy_set_header        Host $host:$server_port;
        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_redirect          http://localhost:38080 https://jenkins.my-server.de;
        proxy_pass              http://localhost:38080;
    
        proxy_http_version 1.1;
        proxy_request_buffering off;
        proxy_buffering off;
        add_header 'X-SSH-Endpoint' 'jenkins.my-server.de:50022' always;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-28
      • 1970-01-01
      • 2018-02-22
      • 2017-07-17
      • 2017-11-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多