nginx proxy server with https

Ubuntu 24.04

Setting up a proxy server is quite straightforward.

Suppose you have some web service running on port 8008. From the local machine it is accessible by http://localhost:8008. We'd like to have it accessible from outside, secure (https) and on the default port 443.

Installation and configuration is similar to a regular webserver.

Replace step 3 with this one:

3- paste this into the config file

server {
  server_name mydomain.com; // your FQDN here
  root /opt/www; // root path of the webserver

  location / {
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   Host $host;
    proxy_pass         http://localhost:8008/; // your web service
    proxy_http_version 1.1;
    proxy_set_header   Upgrade $http_upgrade;
    proxy_set_header   Connection "upgrade";
  }
}

That's pretty much it.

-jer


You'll only receive email when they publish something new.

More from jertaa
All posts