Self-hosting setup
Deployed apps
Public hosting
pumppi.devrust test apppumppi.devsshtsoha.pumppi.devtimetrialsbort.pumppi.devclosest bus-stop timesreaktor.pumppi.devbackend for reaktor 2023 summer job applicationcal.pumppi.devcalendar- minecraft server (currently not running)
Ports on server
tsoha.pumppi.dev5000reaktor.pumppi.dev5050- radicale 5232
- Postgres-database: 5432
bort.pumppi.dev5500brewery.pumppi.dev5555pumppi.dev: 8000mine.pumppi.dev25565
Local hosting
- Mysql
- Postgres
- Nginx
- ddclient
Howto
Connecting to router
ssh -L 8080:<ROUTER_IP>:<ROUTER_PORT> pumppi.dev
And voila, the router is accessible at http://localhost:8080.
Add new subdomain
Namecheap
First add new subdomain to namecheap with A + Dynamic DNS Record.
The IP can be anything, it will be overwritten by 'ddclient`.
DDClient
Next ssh into the server and add the new subdomain to the
ddclient's config located in the /etc/ddclient/ddclient.conf.
After editing the config, restart the service with
sudo systemctl restart ddclient.service
Check if the IP has updated in namecheap for the new domain.
If the IP has not changed, don't continue. FIX IT.
Nginx
Edit or add a config file in /etc/nginx/sites-available/<your-domain-name>.
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name <your_server_name>;
# ssl_certificate /etc/letsencrypt/live/<YOUR_DOMAIN_NAME>/fullchain.pem; # managed by Certbot
# ssl_certificate_key /etc/letsencrypt/live/<YOUR_DOMAIN_NAME>/privkey.pem; # managed by Certbot
# include /etc/letsencrypt/options-ssl-nginx.conf;
location / {
proxy_pass http://127.0.0.1:<PORT_OF_THE_APP>;
}
}
Note
Leave the ssl cert things commented for now. Before running certbot having
the lines uncommented will result in an error. The files do not exist yet!
After editing we can test if the new config is valid with
nginx -t
You might need sudo for this.
Certbot
Next we move to getting the certifications. With nginx its dead
simple. Just run
sudo certbot certonly --nginx
and it should work. If there are errors, fix them. And that should be it.
After all
Make sure your process is running and it should be served to the outside world.
Happy self hosting :)