using a VPS as a proxy server for HTTP and SSH. #
I am aware that this post is a little rough, I'm not sorry.
obtaining a VPS #
- the cheapest plan with an dedicated (and probably static) ipv4/ipv6 should be enough. my current vps is only using about 120mb of ram and mostly idles.
installing nginx #
1su -
2apt update && apt -y upgrade
3apt -y install nginx nginx-common libnginx-mod-stream # latter one should not be needed but I install it anyways
configuring nginx #
1cd /etc/nginx && mkdir rproxy && cd rproxy && mkdir stream stream/available stream/enabled
2nvim stream/available/ssh.conf
Add the following content:
1upstream ssh {
2 server home-server-ip:22;
3}
4
5server {
6 listen 22;
7 proxy_pass ssh;
8}
nginx.conf #
1cd /etc/nginx && nvim nginx.conf
now change the following content:
1 include /etc/nginx/conf.d/*.conf;
2 # include /etc/nginx/sites-enabled/*;
3 include /etc/nginx/rproxy/http/enabled/*.conf;
4}
5
6stream {
7 include /etc/nginx/rproxy/streams/enabled/*.conf;
8}
so now, the Virtual Host section should look like this #
1# Virtual Host Configs
2 include /etc/nginx/conf.d/*.conf;
3 # include /etc/nginx/sites-enabled/*;
4 include /etc/nginx/rproxy/http/enabled/*.conf;
5}
6
7stream {
8 include /etc/nginx/rproxy/streams/enabled/*.conf;
9}
activating our configurations #
1ln -s /etc/nginx/rproxy/http/available/*.conf /etc/nginx/rproxy/http/enabled
2ln -s /etc/nginx/rproxy/stream/available/*.conf /etc/nginx/rproxy/stream/enabled
finally, test if everything is correct:
nginx -t
restart nginx #
1systemctl restart nginx
that's all #
last updated: