Sonny AD
Sonny AD

Reputation: 31

Serve HTTP through SSH with Nginx?

We have a server that is stuck inside our office network, and we would like to access it from outside office.

I already set up an ssh tunnel on it to one of our public server in a cloud computing company. I can then access our internal server by ssh through the public server.

But this internal server is mostly serving webservices. We'd like then to be able to access the webservices there through the public server and the tunnel ssh between these both.

Is there any way of doing that with nginx? or any other software actually.

Sonny

Upvotes: 0

Views: 668

Answers (2)

Sonny AD
Sonny AD

Reputation: 31

I have been able to find a solution actually.

The proxy_pass only works from with a direct http/https stream which I didn't have at that time.

But actually I have now. The ssh tunnel I am using is basically a TCP port redirection. So I set up a second tunnel pipe on the port of my Apache on our internal server and ssh magic allows me to access this internal server webservices through my cloud server now! Thanks SSH.

Also I use this tool: http://www.harding.motd.ca/autossh/, to prevent my tunnels from going down.

Upvotes: 1

hyde
hyde

Reputation: 36

You should use the proxy_pass directive, for instance:

location /{
    proxy_pass http://<the private server ip>:<the private server http port>/;
}

It will then redirect every request to your private server

Upvotes: 1

Related Questions