nginx is my preferred lightweight HTTP/HTTPS server and fairly easy to do reverse proxy for. In this
example, I use a reverse proxy to expose an internal service running on port 82 to the Internet.
Here is an example config …
server {
server_name example.vernon.wenberg.net; # must match the sub.host
portion of the URL
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100M; # increase size of uploaded files
location / {
proxy_pass http://internal-service.vernon.wenberg.net:82; #
internal server address and port
}
# Insert SSL certificate block here
}
example.vernon.wenberg.net
is a sub-domain that exists on the public Internet whileinternal-service.vernon.wenberg
is an internal system. This also allows the use of an SSL
certificate on your nginx server instead of your internal server.