Yea, I've set up soho type stuff but not web servers that needed these sorts of features :! Sooo I got it working except on nginx side I can still get to the dashboard through
http://domain:1880, however
http://domain redirects to ssl and works now! (not sure why 1880 not redirecting since its also http) Something in my nginx config. Here is what I did these IPTable rules.
tun0 is my vpn interface, eth0 is my lan.
10.8.0.1 is my server 10.8.0.6 is the client
sudo iptables -A FORWARD -i eth0 -o tun0 -p tcp --syn --dport 80 -m conntrack --ctstate NEW -j ACCEPT
sudo iptables -A FORWARD -i eth0 -o tun0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -A FORWARD -i tun0 -o eth0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 1880 -j DNAT --to-destination 10.8.0.6
sudo iptables -t nat -A POSTROUTING -o tun0 -p tcp --dport 1880 -d 10.8.0.6 -j SNAT --to-source 10.8.0.1
Here is my nginx config.
server {
listen 443 ssl;
server_name domain www.domain;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://10.8.0.6:1880;
# try_files $uri $uri/ =404; (should I leave this on? dunno)
}
ssl_certificate /etc/letsencrypt/live/domain/fullchain.pem; # m$
ssl_certificate_key /etc/letsencrypt/live/domain/privkey.pem; #$
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
# Redirect non-https traffic to https (this not working at least on port 1880)
if ($scheme != "https") {
return 301 https://$host$request_uri;
} # managed by Certbot
}
I think I have the right idea, I will look up nginx TLS endpoint stuff and continue the climb.