Nginx con url arbitraria en el subdirectory que sirve el mismo contenido

Como ejemplo, me gustaría servir a example.com/public/anyUserName, donde anyUserName es una combinación de caracteres distintos de los separadores de routes, del directory / webapps / client. Por lo tanto, una consulta a example.com/public/Alice y una consulta a example.com/public/Bob se publicarán desde el mismo directory. Debería poder solicitar files como example.com/public/Alice/css/bootstrap.css o http://example.com/public/Alice/client.js sin problema. Básicamente, quiero eliminar la parte de nombre de usuario de la url y servir desde el mismo directory, pero tengo que mantener el nombre de usuario en la url del browser.

He intentado muchos ajustes diferentes de la configuration de un regex en la localización a esta monstruosidad pero en cada caso consigo un 404, un 500 que los loggings dicen es una reescritura o un ciclo interno de la networkingirección, un 200 en cada recurso pero cada uno es el índice, o un 200 en cada recurso, pero cada uno excepto el índice es un 404.

location /public { index collmanagerclient.html; alias /webapps/client; autoindex on; try_files $2/$3/$4/$5/$6 $2/$3/$4/$5/$6/ =404; } 

Esta es mi configuration de nginx:

 server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } nombre_server secure.example.me; server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } } server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } nombre_server secure.example.me; server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } ssl_certificate /etc/nginx/ssl/ssl-unified.crt; server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } ssl_ciphers server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } ECDHE-ECDSHA-ECDSH-AES128-GCM-SHA256: ECDHE-ECDSHA-AES128-GCM-SHA256: ECDHE-RSA-AES256-GCM-SHA384: ECDHE- RSA-AES128-SHA256: ECDHE-ECDSHA-AES128-SHA256: ECDHE-RSA-AES128-SHA: ECDHE-RSA-AES256-SHA384: AES256-SHA: DHE-RSA-AES256-SHA: DHE-RSA-AES128-SHA256: DHE-RSA-AES256-SHA256: SHA384: ECDHE-RSA-RC4-SHA: ECDHE-ECDSA-RC4-SHA: RC4-SHA: ALTO:! ANULL:! ENULL:! EXPORT: DES: 3DES: MD5: PSK; server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } ssl_ecdh_curve secp521r1; server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } root / webapps / cliente; server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } index collmanagerclient.html; server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } } server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } location ~ /public/(?:[^/]+)/(?<filename>.+) { server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } alias / webapps / cliente; server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } rewrite ^ $ filename last; server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } } server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } location / signup { server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } index collmanagersignup.html; server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } alias / webapps / signup; server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } } server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } #turn gzip off para evitar romper la CPU server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } proxy_pass http: // localhost: 7801; server { listen 80; server_name secure.example.me; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name secure.example.me; ssl on; ssl_certificate /etc/nginx/ssl/ssl-unified.crt; ssl_certificate_key /etc/nginx/ssl/ssl.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK; ssl_prefer_server_ciphers on; ssl_ecdh_curve secp521r1; root /webapps/client; index collmanagerclient.html; location = / { try_files $uri $uri/ =404; } location ~ /public/(?:[^/]+)/(?<filename>.+) { alias /webapps/client; rewrite ^ $filename last; } location /signup { index collmanagersignup.html; alias /webapps/signup; try_files $uri $uri/ =404; } location /api { #turn gzip off to avoid breaking the cpu gzip off; proxy_pass http://localhost:7801; proxy_buffering off; include /etc/nginx/proxy.conf; } 

}

Gracias, me he vuelto loco en el último momento.

Creo que usted necesita mirar en el module de reescritura. Módulo Rewrite de Nginx

Algo como:

location / público {rewrite ^ / Foo last; }

Tal vez este hace lo que quiere:

 location ~ ^/public/(?:[^/]+)/(?<filename>.+)/?$ { alias /webapps/client; rewrite ^ $filename last; } location / / / / (?: [^ /] +) / (? <filename>. +) /? $ { location ~ ^/public/(?:[^/]+)/(?<filename>.+)/?$ { alias /webapps/client; rewrite ^ $filename last; } alias / webapps / cliente; location ~ ^/public/(?:[^/]+)/(?<filename>.+)/?$ { alias /webapps/client; rewrite ^ $filename last; } rewrite ^ $ filename last; location ~ ^/public/(?:[^/]+)/(?<filename>.+)/?$ { alias /webapps/client; rewrite ^ $filename last; } 

Y luego, use esto para replace location = / block:

 location / { try_files $uri $uri/ =404; } 

Aquí usamos expresiones regulares para coincidir primero con URIs como /public/username/file_to_get.html.

La primera parte entre / caracteres captura el nombre de usuario y lo almacena en ninguna parte ( ?: Modificador).

La segunda parte captura el nombre de file real deseado a la variable $filename .

Luego, simplemente reescribimos el URI de request en el nombre de file capturado.