nginx背后的Artifactory - 连接被拒绝

时间:2015-10-08 08:45:08

标签: nginx teamcity artifactory connection-refused

我在端口8081上的服务器上运行Artifactory。我需要具有标准的http访问权限,因此还有nginx作为具有这些简单规则的反向代理:

incoming port 80 -> redirect to 443 (http -> https)
incoming port 443 -> proxy to localhost:8081

适用于浏览器。但是,我运行的TeamCity服务器需要从此存储库中解析工件。它可以找到它需要的文件,但是当它们应该被下载时,我会收到连接拒绝错误:

[10:21:38][Step 3/5] Resolving published dependencies with pattern UNIX-SDK:linux32_builds/build/sdk/*
[10:21:38][Step 3/5] Found 54 dependencies by doing a pattern search.
[10:21:38][Step 3/5] Target directory: /Users/steve/teamcity/buildAgent/work/d6dd50479f4d9106/build/sdk/openssl/current/include/openssl/dh.h
[10:21:38][Step 3/5] Error occurred while resolving published or build dependencies: Connection refused
[10:21:38]
[Step 3/5] java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:579)
    at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
    at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
    at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:882)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
    at org.jfrog.build.client.PreemptiveHttpClient.execute(PreemptiveHttpClient.java:88)
    at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryDependenciesClient.execute(ArtifactoryDependenciesClient.java:185)
    at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryDependenciesClient.getArtifactChecksums(ArtifactoryDependenciesClient.java:174)
    at org.jfrog.build.extractor.clientConfiguration.util.DependenciesDownloaderHelper.getDependencyLocally(DependenciesDownloaderHelper.java:116)
    at org.jfrog.build.extractor.clientConfiguration.util.DependenciesDownloaderHelper.downloadArtifact(DependenciesDownloaderHelper.java:77)
    at org.jfrog.build.extractor.clientConfiguration.util.DependenciesDownloaderHelper.downloadDependencies(DependenciesDownloaderHelper.java:40)
    at org.jfrog.teamcity.agent.DependenciesDownloaderImpl.download(DependenciesDownloaderImpl.java:57)
    at org.jfrog.build.extractor.clientConfiguration.util.DependenciesHelper.retrievePublishedDependencies(DependenciesHelper.java:52)
    at org.jfrog.teamcity.agent.DependenciesResolver.retrievePublishedDependencies(DependenciesResolver.java:50)
    at org.jfrog.teamcity.agent.listener.AgentListenerBuildInfoHelper.retrievePublishedAndBuildDependencies(AgentListenerBuildInfoHelper.java:99)
    at org.jfrog.teamcity.agent.listener.AgentListenerBuildInfoHelper.beforeRunnerStart(AgentListenerBuildInfoHelper.java:84)
    at org.jfrog.teamcity.agent.ArtifactoryAgentListener.beforeRunnerStart(ArtifactoryAgentListener.java:80)
    at sun.reflect.GeneratedMethodAccessor55.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at jetbrains.buildServer.util.EventDispatcher.dispatch(EventDispatcher.java:120)
    at jetbrains.buildServer.util.EventDispatcher$2.invoke(EventDispatcher.java:67)
    at com.sun.proxy.$Proxy6.beforeRunnerStart(Unknown Source)
    at jetbrains.buildServer.agent.impl.buildStages.runnerStages.start.FireBeforeRunnerStartedStage.fireEvent(FireBeforeRunnerStartedStage.java:27)
    at jetbrains.buildServer.agent.impl.buildStages.runnerStages.start.FireEventRunnerStageBase.doBuildStage(FireEventRunnerStageBase.java:29)
    at jetbrains.buildServer.agent.impl.buildStages.RunnerStagesExecutor$1.callStage(RunnerStagesExecutor.java:25)
    at jetbrains.buildServer.agent.impl.buildStages.RunnerStagesExecutor$1.callStage(RunnerStagesExecutor.java:18)
    at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.callRunStage(StagesExecutor.java:78)
    at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.doStages(StagesExecutor.java:37)
    at jetbrains.buildServer.agent.impl.buildStages.RunnerStagesExecutor.doStages(RunnerStagesExecutor.java:18)
    at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.RunnerContextExecutor.callRunnerStages(RunnerContextExecutor.java:43)
    at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.StepExecutor.processNextStep(StepExecutor.java:25)
    at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.ForEachBuildRunnerStage.executeRunnerStep(ForEachBuildRunnerStage.java:138)
    at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.ForEachBuildRunnerStage.runStep(ForEachBuildRunnerStage.java:123)
    at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.ForEachBuildRunnerStage.executeBuildRunners(ForEachBuildRunnerStage.java:83)
    at jetbrains.buildServer.agent.impl.buildStages.startStages.steps.ForEachBuildRunnerStage.doBuildStage(ForEachBuildRunnerStage.java:44)
    at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor$1.callStage(BuildStagesExecutor.java:31)
    at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor$1.callStage(BuildStagesExecutor.java:24)
    at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.callRunStage(StagesExecutor.java:78)
    at jetbrains.buildServer.agent.impl.buildStages.StagesExecutor.doStages(StagesExecutor.java:37)
    at jetbrains.buildServer.agent.impl.buildStages.BuildStagesExecutor.doStages(BuildStagesExecutor.java:24)
    at jetbrains.buildServer.agent.impl.BuildRunActionImpl.doStages(BuildRunActionImpl.java:70)
    at jetbrains.buildServer.agent.impl.BuildRunActionImpl.runBuild(BuildRunActionImpl.java:50)
    at jetbrains.buildServer.agent.impl.BuildAgentImpl.doActualBuild(BuildAgentImpl.java:284)
    at jetbrains.buildServer.agent.impl.BuildAgentImpl.access$100(BuildAgentImpl.java:52)
    at jetbrains.buildServer.agent.impl.BuildAgentImpl$1.run(BuildAgentImpl.java:248)
    at java.lang.Thread.run(Thread.java:745)

当我直接连接到8081端口时,它运行良好。我缺少一些nginx配置吗?我按照各种指南设置了它,但没有提到任何相关的内容。

nginx反向代理配置是这样的:

server {
        listen 80;
        server_name artifactory.ourdomain.com;
        return 301 https://$server_name$request_uri;
    }

    server {
        listen 443;
        server_name artifactory.ourdomain.com;

        ssl on;
        ssl_certificate /etc/nginx/cert/artifactory-cert-chain.crt;
        ssl_certificate_key /etc/nginx/cert/artifactory.key;

        location / {
            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_pass http://localhost:8081;
            proxy_read_timeout 90;

            proxy_redirect http://localhost:8081 https://artifactory.ourdomain.com;
        }
    }

感谢您的帮助!

0 个答案:

没有答案