I am wondering if someone can please help me with something that I am racking my brain with. I have a folder structure like this;
/var/www/<user>/<user>/
So to see the files currently with NGINX I need to naviagte to;
https://<host>/<user>/<user>
What I want to do is make it so I can navigate to the following and it is re-written silently in the backend.
https://<host>/<user>/
To achieve this, I have written the following rule
location ~ ^/(.*)/(.*)$ {
index index.html;
try_files $uri /$1/$uri/index.html /$1/$uri;
}
It seemed to work once but since it unfortunately keeps rewriting in a continuous loop. I've tried a few things and understand why it loops but I cannot work out how to stop it.
Now, you may be wondering why have this folder structure. It's a long story but basically I want a user to only have access to their files and with Chroot (for sftp) the root dir must be owned by root so it needs a subdirectory to make it work due to permissions.