Skip to content

Instantly share code, notes, and snippets.

@tomrockdsouza
Last active December 30, 2023 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomrockdsouza/d41e6cec7aaa2bbaa3867e1b1ec2430e to your computer and use it in GitHub Desktop.
Save tomrockdsouza/d41e6cec7aaa2bbaa3867e1b1ec2430e to your computer and use it in GitHub Desktop.
Commands and Instruction to expose your local server unlimited on the web with any domain or subdomain

Youtube Tutorial


##local-pc
ssh-keygen -t ed25519 -C "user@example.com" -f demo
ssh -i demo ubuntu@IPX

##server
sudo su
iptables -F
apt update
apt -y install nginx
apt -y install nano
nano /etc/nginx/nginx.conf

Comment out #include /etc/nginx/sites-enabled/*;

----------------------------------------------------
server {
    listen 80;
    server_name catch1.example.com;
    location / {
        proxy_pass http://localhost:8001;
        proxy_set_header Host $host;
        proxy_pass_request_headers on;
    }

}
server {
    listen 80;
    server_name catch2.example.com;
    location / {
        proxy_pass http://localhost:8002;    
        proxy_set_header Host $host;
        proxy_pass_request_headers on;
    }
}
server {
    listen 80 default_server;
    return 404;
}
----------------------------------------------------

nano /etc/ssh/sshd_config
uncomment and edit - GatewayPorts yes
iptables -F
reboot now


##local-pc
### start server at port 8001
### start server at port 8002
ssh -i demo -f -N -R \\*:8001:127.0.0.1:8001 ubuntu@IPX
ssh -i demo -f -N -R \\*:8002:127.0.0.1:8002 ubuntu@IPX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment