Skip to content

Commit 084c8ad

Browse files
committed
document apache virtual host + ssh port forwarding method
1 parent f25ab04 commit 084c8ad

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/site/markdown/https.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,34 @@ You need to get a certificate for your hostname, e.g. with https://letsencrypt.o
5151
since all that is a bit complicated, I'm only going to describe this if you ask me. :-) One advantage is that you
5252
don't need to remember to start and stop a tunnel.
5353

54+
## SSH port forwarding + Reverse proxy
55+
56+
If you have a host in the cloud that has a wildcard SSL certificate and a web server like apache that supports
57+
creating virtual hosts and have set up passwordless login with ssh public key authentication, then you can:
58+
59+
1. set up a new virtual host with a reverse proxy that goes to your cloud host, e.g. port 3002
60+
2. start ssh with forwarding that remote port to your local host, e.g.
61+
`ssh -T -N -R 3002:localhost:3002 [email protected]`
62+
63+
For the virtual host you'll probably need to set up a DNS CNAME record that maps that virtual host to your main host.
64+
For Apache 2 a site setup would be e.g.
65+
66+
```
67+
<VirtualHost *:443>
68+
ServerName yourvirtualhost.your.domain
69+
70+
SSLEngine On
71+
SSLCertificateFile /etc/ssl/certs/your.domain_ssl_certificate.cer
72+
SSLCertificateKeyFile /etc/ssl/private/_.your.domain_private_key.key
73+
SSLCACertificateFile /etc/ssl/certs/_.your.domain_ssl_certificate_INTERMEDIATE.cer
74+
Include /etc/letsencrypt/options-ssl-apache.conf
75+
76+
ProxyPreserveHost On
77+
ProxyPass / http://localhost:3002/
78+
ProxyPassReverse / http://localhost:3002/
79+
</VirtualHost>
80+
```
81+
5482
## Services that do (probably) not work
5583

5684
If you feel like experimenting: [LocalTunnel](https://theboroer.github.io/localtunnel-www/) might or might not

0 commit comments

Comments
 (0)