-
Notifications
You must be signed in to change notification settings - Fork 10
How to get and Setup a Reverse Proxy with DDOS Protections for Free on A Static or Dynamic DNS
IMPORTANT NOTE:
THIS IS NOT FOR BEGINNERS. I AM GOING TO TRY TO EXPLAIN THE PROCESS AS BEST AS I CAN BUT THIS IS PRETTY IN DEPTH PROCESS.
[Interface]
PrivateKey = [Your Winodws Made Priavte Key]
ListenPort = 49312
Address = 10.254.0.1/24
[Peer]
PublicKey = [YOUR-ORACLE-VPS-KEY]
AllowedIPs = 10.254.0.2/24
Endpoint = [ORACLE-VPS-IP]:49312
[Interface]
PrivateKey = [private key for vps]
Address = 10.254.0.2/24
ListenPort = 49312
SaveConfig = true
PostUp = iptables -t nat -I POSTROUTING -o enp0s3 -j MASQUERADE
PreDown = ufw route delete allow in on wg0 out on enp0s3
PreDown = iptables -t nat -D POSTROUTING -o enp0s3 -j MASQUERADE
[Peer]
PublicKey = [pubkey for windows machine]
AllowedIPs = 10.254.0.1/32
Endpoint = [external home internet ip]:49312
PersistentKeepalive = 25
- Installation of Wireguard
sudo apt install wireguard
- Get Your VPS's Wireguard Private Key
wg genkey | sudo tee /etc/wireguard/private.key
- Make the private key executable
sudo chmod go= /etc/wireguard/private.key
- Grab your VPS's Public key to input inside your windows wireguard
sudo cat /etc/wireguard/private.key | wg pubkey | sudo tee /etc/wireguard/public.key
- Once you have setup Windows Wireguard Config and your Ubuntu Wireguard config run the start command for wireguard in your VPS
wg-quick up {interface name}
ie. wg-quick up wg0
If you mess up your config you can delete and re-do the above command
Delete the wireguard adapter (this will just delete the your original wireguard interface adapter in your network adapters they can always be re-added)
Command to Delete wireguard interface:
sudo ip link delete {interface name}
IE.
sudo ip link delete wg0
- Download Caddy
- Move Caddy Once Downloaded to user bin
sudo mv caddy /usr/bin/
- Change the Permissions to Read and Write for Caddy Binary
sudo chmod +x /usr/bin/caddy
- Check to make sure caddy can run
caddy version
- Create a group named caddy:
sudo groupadd --system caddy
- Create a user named caddy with a writeable home directory:
sudo useradd --system \
--gid caddy \
--create-home \
--home-dir /var/lib/caddy \
--shell /usr/sbin/nologin \
--comment "Caddy web server" \
caddy
- Make or Edit your Caddyfile
sudo nano /etc/caddy/Caddyfile
-
Add the config from Wiki Examples here
-
Reload all Service Scripts
sudo systemctl daemon-reload
- Enable Caddy Service
sudo systemctl enable --now caddy
- Check to see if its Running
systemctl status caddy
- Check the Logs of Caddy
journalctl -u caddy --no-pager | less +G
- If your edit your Caddyfile reload the Caddy binary by using
sudo systemctl reload caddy
or just restart it by
sudo systemctl restart caddy