我有一个 Artifactory 在端口 8081 上的服务器上运行。我需要有标准的 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;
}
}
谢谢您的帮助!