Reverse proxy (proxy_pass) a docker port with nginx and use certbot for https¶
// i managed to do it with docker-compose, might also work with docker run or whatever but idk
i made this specifically for ッツ jp reader cuz i wanted to self host it myself, not like i dont trust that fella but it is what it be
check to see if the containter is running with
docker ps
u should see the port it's running on, in my case it s 9010:
If you visited yoursite.com:9010 it should work as it should, however it wont be secure cuz no https
this guide assumes u wanna run it on a subdomain, so
add this in ur dns records:
ttureader.yoursite.com - IPv4 (A record) to ur servers IPv4
ttureader.yoursite.com - IPv6 (AAAA record) to ur servers IPv6
optionally do the same thing but with www.ttureader.yoursite.com
Then, create an nginx conf file, name it however u like
nano /etc/nginx/sites-available/ttureader
paste the following inside and change the domain name (yoursite.com
) and the port if it's different (http://localhost:9010
)
server {
server_name ttureader.**yoursite.com** www.ttureader.**yoursite.com**;
location / {
proxy_pass http://localhost:9010;
}
listen 80;
listen [::]:80;
}
ln -s /etc/nginx/sites-available/ttureader /etc/nginx/sites-enabled
systemctl reload nginx
Now when u visit ttureader.yoursite.com
it should correctly redirect to ッツs reader
for https, quite simple, run
certbot --nginx
either select all domains or just the 2 we made, wait until it's resolved and voila ure done
if u were to open the conf file, ud see it has cerbot has certbotted all over it, hopefully it says congratulations