首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >禁用JFrog目录列表

禁用JFrog目录列表
EN

Stack Overflow用户
提问于 2018-02-13 09:43:29
回答 1查看 302关注 0票数 0

我可以禁用我的JFrog Artifactory存储库的目录列表吗?我用nginx做Artifactory的。

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

我试过用autoindex off不起作用。

我的配置

代码语言:javascript
复制
## 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;
    }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-02-13 13:10:50

在Artifactory中没有禁用目录列表的开箱即用功能。

目录清单是由Artifactory本身创建的,而不是nginx,这就是设置autoindex没有任何效果的原因。

如果希望阻止特定存储库的目录列表,可以配置nginx以防止对相关存储库URL的访问。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48763696

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档