user2395365
user2395365

Reputation: 2149

How to configure NGINX to proxy to web server behind VPC

I have a webserver behind a VPC and normally we setup an SSH tunnel and connect to localhost with a web browser. However to make it easier to connect to the site via a mobile device I was thinking of using our NGINX installed on the bastion/gateway server to proxy requests to the web server behind the VPC. Does anyone have a configuration of what is needed in NGINX to do this? Thanks!

Upvotes: 1

Views: 1051

Answers (1)

Ivan Balepin
Ivan Balepin

Reputation: 487

Sounds like a simple reverse proxy - to expose your internal web server e.g. 172.31.0.1 to the outside at /some/path/:

location /some/path/ {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://172.31.0.1;
}

Upvotes: 1

Related Questions