ARTIFACTORY: The Recommended Nginx Reverse Proxy Configuration for Artifactory 7

Yonatan Brand
2023-01-22 11:07

Relevant versions: This information pertains to Artifactory versions 7.x and above

In Artifactory 7.x, a few changes were made regarding the reverse proxy configuration for Nginx. The correct snippet should now include the following: (make sure to change the colored fields according to your server)

###########################################################
## this configuration was generated by JFrog Artifactory ##
###########################################################
## server configuration
server {
listen 80 ;
server_name <SERVER_NAME>;
if ($http_x_forwarded_proto = '') {
set $http_x_forwarded_proto $scheme;
}
## Application specific logs
## access_log /var/log/nginx/<SERVER_NAME>-access.log timing;
## error_log /var/log/nginx/<SERVER_NAME>-error.log;
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://<SERVER_IP>: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://<SERVER_IP>:8081;
}
}
}

Published: Dec. 28, 2020
Last updated: May. 24, 2021

Keywords: Nginx, Reverse-Proxy