Soy un novato en el desarrollo de un portal para servir archivos estáticos. Quiero configurar nginx para servidores de archivos estáticos basados en la autenticación del usuario. Para el usuario 1 quiero poder ver solo el archivo 1 Para el usuario 2 quiero poder ver solo el archivo 2
My current nginx configuration is: # For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; # Load modular configuration files from the /etc/nginx/conf.d directory. # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; server { listen 80 default_server; listen [::]:80 default_server; server_name _; root /usr/share/nginx/files; autoindex on; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; location / { try_files $uri $uri/ =404; auth_basic "Restricted Content"; auth_basic_user_file /etc/nginx/.htpasswd; } error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } } [root@webportal files]# pwd /usr/share/nginx/files [root@webportal files]# ls -al total 4 drwxr-xr-x. 2 root root 32 May 5 10:08 . drwxr-xr-x. 5 root root 46 May 5 09:27 .. -rw-r--r--. 1 root root 4 May 5 09:45 1.txt -rw-r--r--. 1 root root 0 May 5 10:08 2.txt¿Pueden aconsejarme cuál sería la forma más sencilla de asignar el archivo 1.txt al usuario 1 y 2.txt al usuario 2? Básicamente, cuando uno de los usuarios se autentica en el portal solo tiene acceso a uno de los archivos