p Once I wanted to have a “tilde user directories” like #[code /~user/] which is more known as Apache's #[code mod_userdir] feature. I work with NGiNX so regular expressions is the way to do that.
p Nothing special in my case. I only need to keep files there, so others may get them. Thing is simple, but I took some time to realise what regexp to use here back then.
p The implementation is quite simple:
pre
| location ~ ^/~(.+?)(/.*)?$ {
| alias /home/$1/pub$2;
| autoindex on;
| }
p Of course, you can choose whatever place for user's public directories. In my case you need to give a read and execute permissions to user's home directory and to public directories inside them to others (#[code chmod o=rX /home/user]), which may be a security concern.
p #[code autoindex on] will make an index of files that lies by URL. And, of course, you can put there an #[code index.html] file.
p Let's say in #[code http] block you specified common headers like #[code X-Frame-Options], #[code X-XSS-Protection], and so on for all #[code server] directives to use. But, if you add some other header for a specific #[code server] or #[code location] block then all those headers would be dropped.
p For now the only cure for it is to place all that headers in a separate file like #[code common-headers.inc] and using #[code include] directive to include them in all the #[code server] and #[code location] blocks where additional headers are added.
h3#art-4 #[a(href='#art-3') 4. Tell a Tor visitor of your clearnet site that you have an onion]
p There is a custom HTTP header #[code Onion-Location] that is being recognised by Tor Browser and it will show a ".onion available" button in an address bar.