Made the data folder an envvar
This commit is contained in:
parent
f23290e1a4
commit
4164b11fa9
1 changed files with 39 additions and 0 deletions
39
nginx/subdomains_and_reverse_proxy.md
Normal file
39
nginx/subdomains_and_reverse_proxy.md
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# Subdomain and reverse proxy
|
||||
|
||||
Now that I have my own domain, life is pretty cool. I can leave behind the
|
||||
harsh days of typing my server IPs in the browser, and point to my services
|
||||
with nice names.
|
||||
|
||||
Through porkbun's UI, I can point my domain name to any ip. But, I can't
|
||||
specify anything related to ports! After some research, I found out what I
|
||||
could do is to specify different subdomains in porkbun, and set up a reverse
|
||||
proxy in nginx to direct traffic thanks to this subdomains. Basically, I tell
|
||||
porkbun to direct each subdomain to my IP, and then I set up the nginx running
|
||||
in navaja to point to different docker containers depending on the subdomain
|
||||
that is getting requested.
|
||||
|
||||
This is an example on how to set the reverse proxy config in nginx:
|
||||
|
||||
```
|
||||
server {
|
||||
listen 80;
|
||||
server_name git.contrapeso.xyz;
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_pass http://gogs_web_1:3000;
|
||||
proxy_redirect off;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Where `git.contrapeso.xyz` is the subdomain and the contents of `proxy_pass` is
|
||||
where requests should be redirected.
|
||||
|
||||
Something not obvious to take into account: since my nginx is running within a
|
||||
docker container, networking within navaja is a bit tricky. The way I got it
|
||||
right is to:
|
||||
|
||||
- Make sure that the nginx container is running in the same network as the one
|
||||
where traffic should be redirected.
|
||||
- Redirect using the container name and the listening port _within_ the
|
||||
container, not the redirecting one in the host.
|
||||
Loading…
Add table
Add a link
Reference in a new issue