Rundeck背后和SSL代理

时间:2017-06-07 10:54:19

标签: ssl nginx reverse-proxy rundeck

我目前正在尝试建立一个运行Rundeck和nginx反向ssl代理的环境。我在这个场景中找到了不同的在线教程,但没有一个对我有用。我在一个运行rundeck和nginx的linux环境中工作。我的rundeck的nginx配置文件就像这样:

server {
        access_log   /var/log/nginx/rundeck.access.log  main;


        listen 443;
        listen       [::]:443;
        ssl    on;
        ssl_certificate    /etc/nginx/conf.d/cert.crt;
        ssl_certificate_key    /etc/nginx/conf.d/key.rsa;

        location / {
          proxy_pass http://localhost:4440/;
          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-Ssl on;
}

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

此外,我在rundeck中配置了这些参数: framework.server.url = https://localhost:4440grails.serverURL=https://lde71d6p.de.top.com:443 我尝试了与https或仅http的不同组合,没有端口和端口。它们都没有正常工作。

使用当前配置,我得到以下错误情况。 如果我尝试拨打https://docs.liferay.com/portal/6.2/javadocs/src-html/com/liferay/portal/service/ServiceContext.html#line.69 - >连接错误(看起来很好,因为端口80不是由nginx处理的) http://hostname.top.com - >获取302并被重定向到https://hostname.top.com并获得连接错误。 http://hostname.top.com/user/login;jsessionid=xxxxxxx让我直接进入rundeck的登录界面。一切都很好。

有人可以帮我解决我先提到的错误情况吗?

亲切的问候,

最高

2 个答案:

答案 0 :(得分:1)

要在SSL代理后面运行Rundeck,您需要以下三个设置:

https://github.com/rundeck/rundeck/wiki/FAQ#can-i-do-ssl-offloading

  • 将RunDeck设置为http
  • 在配置文件中
  • ,将选项-Drundeck.jetty.connector.forwarded = true添加到RDECK_JVM
  • 设置framework.rundeck.url和grails.serverURL以使用https

在您的情况下,个人资料设置似乎尚未完成。

个人资料位于/etc/rundeck/profile。 (这可能取决于分布)

将选项-Drundeck.jetty.connector.forwarded=true添加到RDECK_JVM,如下所示:

RDECK_JVM="-Djava.security.auth.login.config=$JAAS_CONF \
       -Dloginmodule.name=$LOGIN_MODULE \
       -Drdeck.config=$RDECK_CONFIG \
       -Drundeck.server.configDir=$RDECK_SERVER_CONFIG \
       -Dserver.datastore.path=$RDECK_SERVER_DATA/rundeck \
       -Drundeck.server.serverDir=$RDECK_INSTALL \
       -Drdeck.projects=$RDECK_PROJECTS \
       -Drdeck.runlogs=$RUNDECK_LOGDIR \
       -Drundeck.config.location=$RDECK_CONFIG/rundeck-config.properties \
       -Djava.io.tmpdir=$RUNDECK_TEMPDIR \
       -Drundeck.server.workDir=$RUNDECK_WORKDIR \
       -Dserver.http.port=$RDECK_HTTP_PORT \
       -Drundeck.jetty.connector.forwarded=true"

答案 1 :(得分:0)

错误背后的原因

错误-1: listen 443您的服务器没有在端口80上侦听,要修复它,请在您的配置中添加listen 80;

错误-2:location / { proxy_pass http://localhost:4440/;  将请求重定向到4440,获取错误代码302

错误-3& 4:代理配置错误。

请使用以下配置解决您的问题。

server {

listen 80;

server_name <hostname>;

location / {

    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;

    proxy_redirect http://localhost:4440/ /;

    proxy_pass http://localhost:4440/;
    }

 }