我可以禁用JFrog Artifactory存储库的目录列表吗?我使用nginx作为Artifactory。
来自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;
}
}
答案 0 :(得分:0)
在Artifactory中没有禁用目录列表的开箱即用功能。
目录列表由Artifactory本身而不是nginx创建,这就是设置autoindex
无效的原因。
如果要阻止特定存储库的目录列表,可以配置nginx以防止访问相关存储库URL。