本文介绍了JFrog ArtiFactory禁用目录列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以禁用JFrog ArtiFactory存储库的目录列表吗?我在ArtiFactory中使用了ngix。

来自https://www.jfrog.com/confluence/display/RTF/Configuring+NGINX的文档

我尝试使用autoindex off不起作用。

我的配置

## add ssl entries when https has been set in config
ssl_certificate      /etc/nginx/conf.d/example.pem;
ssl_certificate_key  /etc/nginx/conf.d/example.key;
ssl_session_cache shared:SSL:1m;
ssl_prefer_server_ciphers   on;
## server configuration
server {
    listen 80;
    listen [::]:80;
    server_name ~(?<repo>.+).artifactory artifactory;
    return 301  https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name ~(?<repo>.+).artifactory artifactory;


    if ($http_x_forwarded_proto = '') {
        set $http_x_forwarded_proto  $scheme;
    }
    ## Application specific logs
    ## access_log /var/log/nginx/jfrog.log timing;
    ## error_log /var/log/nginx/jfrog-error.log;
    rewrite ^/$ /artifactory/webapp/ redirect;
    rewrite ^/artifactory/?(/webapp)?$ /artifactory/webapp/ redirect;
    rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/$repo/$1/$2;
    chunked_transfer_encoding on;
    client_max_body_size 0;

    location /artifactory/ {
        autoindex off;
        proxy_read_timeout  900;
        proxy_pass_header   Server;
        proxy_cookie_path   ~*^/.* /;
        if ( $request_uri ~ ^/artifactory/(.*)$ ) {
             proxy_pass          http://127.0.0.1:8081/artifactory/$1;
        }
        index index.py;
        autoindex on;
        proxy_pass          http://127.0.0.1:8081/artifactory/;
        proxy_set_header    X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host:$server_port/artifactory;
        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;
    }
}

推荐答案

在ArtiFactory中没有用于禁用目录列表的现成功能。
目录列表是由ArtiFactory自己创建的,而不是由nginx创建的,这就是autoindex设置无效的原因。
如果您希望阻止特定存储库的目录列表,您可以配置nginx以阻止访问相关存储库URL。

这篇关于JFrog ArtiFactory禁用目录列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 06:30