Nginx问题背后的Artifactory 7.x [英] Artifactory 7.x behind nginx issue
问题描述
我重新安装了Artifactory 7.2.1(基于docker),可以正常工作,但是我想通过nginx代理访问它,但无法正常工作.我的工件在
I have a fresh installation of Artifactory 7.2.1(docker based)which is working fine, but I want to access it via nginx proxy, and that's not working. my artifactory is running under http://192.168.211.207:8082/ Custom base URL is set to: http://192.168.211.207:8081/artifactory ->which is redirecting me to http://192.168.211.207:8082/
现在,我有一台同时通过docker在同一台服务器上运行的nginx服务器.
Now, I have an nginx server which is running on the same server, also via docker.
当我尝试访问时:
http://192.168.211.207 ->将我重定向到
http://192.168.211.207 -> redirects me to https://192.168.211.207/artifactory + 502 Bad Gateway
https://192.168.211.207 ->将我重定向到
https://192.168.211.207 ->redirects me to https://192.168.211.207/ui + 502 Bad Gateway
http://192.168.211.207/artifactory ->重定向至https + 502错误网关
http://192.168.211.207/artifactory -> redirects to https + 502 Bad Gateway
https://192.168.211.207/artifactory -> 502错误的网关
https://192.168.211.207/artifactory -> 502 Bad Gateway
由于在任何情况下都无法使用它,所以我不太了解8081端口的含义.端口8082正在运行,但不在nginx代理后面.
I do not really understand what is behind port 8081 since I am not able to use it in any circumstances. The port 8082 is working, but not behind a nginx proxy.
这是我的docker-compose文件:
Here is my docker-compose file:
version: '2'
services:
artifactory:
image: docker.bintray.io/jfrog/artifactory-pro:7.2.1
container_name: artifactory
ports:
- 8081:8081
- 8082:8082
volumes:
- /data/artifactory:/var/opt/jfrog/artifactory
restart: always
ulimits:
nproc: 65535
nofile:
soft: 32000
hard: 40000
nginx:
image: docker.bintray.io/jfrog/nginx-artifactory-pro:7.2.1
container_name: nginx
ports:
- 80:80
- 443:443
depends_on:
- artifactory
links:
- artifactory
volumes:
- /data/nginx:/var/opt/jfrog/nginx
environment:
- ART_BASE_URL=http://localhost:8081/artifactory
- SSL=true
# Set SKIP_AUTO_UPDATE_CONFIG=true to disable auto loading of NGINX conf
#- SKIP_AUTO_UPDATE_CONFIG=true
restart: always
ulimits:
nproc: 65535
nofile:
soft: 32000
hard: 40000
这是我的Nginx配置文件:
and here is my nginx config file:
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_certificate /var/opt/jfrog/nginx/ssl/example.crt;
ssl_certificate_key /var/opt/jfrog/nginx/ssl/example.key;
ssl_session_cache shared:SSL:1m;
ssl_prefer_server_ciphers on;
## server configuration
server {
listen 443 ssl;
listen 80 ;
server_name ~(?<repo>.+)\.artifactory artifactory;
if ($http_x_forwarded_proto = '') {
set $http_x_forwarded_proto $scheme;
}
## Application specific logs
## access_log /var/log/nginx/artifactory-access.log timing;
## error_log /var/log/nginx/artifactory-error.log;
if ( $repo != "" ){
rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/$repo/$1/$2;
}
rewrite ^/$ /ui/ redirect;
rewrite ^/ui$ /ui/ redirect;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
chunked_transfer_encoding on;
client_max_body_size 0;
location / {
proxy_read_timeout 2400s;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_pass http://localhost:8082;
proxy_set_header X-JFrog-Override-Base-Url $http_x_forwarded_proto://$host:$server_port;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location ~ ^/artifactory/ {
proxy_pass http://localhost:8082;
}
}
}
我无法弄清楚我在做什么错,但是由于我不是nginx专家,所以有可能会错过一些事情.
I can't figure out what I am doing wrong here, but is possible to miss something since I am not an nginx expert.
有人发现问题了吗?有人为Nginx和人工版本7.x提供示例配置文件吗?
Does someone spot the issue? Does someone have an example config file for nginx and artifactory 7.x?
推荐答案
谢谢大家的回答.我已经获得了支持的联系,在与专家交谈之后,他们确认在7.x版本中它们不再支持webcontext,因此,在我的情况下,运行两个工件的唯一方法是创建单独的工件子域.
Thank you all for the answers. I have been able to get in touch with support, and after talking with a specialist they confirmed that in the version 7.x they don't support webcontext anymore, therefore in my case, the only way to run two artifactory was to create separate subdomains.
为了让以后的访问者清楚了解这个主题,jFrog支持确认了我,从7.0版及更高版本开始,Artifactory不再支持/webcontext功能,并且他们也不打算支持该功能.
In order to be clear for future visitors of this topic, the jFrog Support confirmed me that starting with version 7.0 and newer, Artifactory does not support /webcontext feature anymore, and they don't plan to support it.
因此,不再可能使用mydomain.com/artifactory-one和mydomain.com/artifactory-two,您必须使用子域.
Therefore mydomain.com/artifactory-one and mydomain.com/artifactory-two is not anymore possible, you have to do it using subdomains.
mydomain.com/artifactory-one->artifactory-one.mydomain.commydomain.com/artifactory-two->artifactory-two.mydomain.com
mydomain.com/artifactory-one -> artifactory-one.mydomain.com mydomain.com/artifactory-two -> artifactory-two.mydomain.com
这篇关于Nginx问题背后的Artifactory 7.x的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!