I am still getting my feet wet with learning about nginx configurations. I am currently able to use the following blocks to proxy some UI files from S3 through an ALB in AWS. I am having issues, though, setting the location paths.
I am only able to access the angular application at the following: https://domainname/index.html
What I am needing is to access the UI files at https://domainname/appname and then load all the files from there. How do I do this? Here is my current nginx.conf file.
server {
listen 80;
server_name <servername>.com;
resolver 8.8.8.8 valid=30s;
index index.html;
gzip_types text/plain application/xml application/x-javascript text/css application/json text/javascript;
location ~* ^/(.*) {
set $S3BUCKET "<bucketnamepassedinhere>.s3.amazonaws.com";
proxy_buffering off;
proxy_ignore_headers "Set-Cookie";
proxy_hide_header x-amz-id-2;
proxy_hide_header x-amz-request-id;
proxy_hide_header x-amz-meta-s3cmd-attrs;
proxy_hide_header Set-Cookie;
proxy_set_header Host $S3BUCKET;
proxy_set_header Connection "";
proxy_intercept_errors on;
proxy_pass https://$S3BUCKET/$1;
break;
}
}