How to forward proxy nginx to custom port

This is a sample nginx proxy config for forwarding nonstandard SSL port to other ip/domain with a custom port, not 443 standard https port

server {
listen 3000 ssl;
server_name xxx.domain.com;
error_page 497 301 =307 https://$host:$server_port$request_uri;

ssl_certificate /etc/letsencrypt/live/xxx.domain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/xxx.domain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

location / {
proxy_pass http://yyy.domain.com:3000/ip:3000;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Ssl on;

}

Discover more from Susiloharjo

Subscribe to get the latest posts sent to your email.

Related Posts

flameshot

solving problem flameshot not run on ubuntu 24.04 lts

As you know Flameshot is a powerful, open-source screenshot tool for Linux and other platforms that offers advanced annotation and editing features directly within the capture interface….

ubuntu bluetooth

bluetooth problem with ubuntu 24.02 lts

I try many ways to fix my bluetooth speaker and finally this works for me , give a try maybe will help you also. restart the Bluetooth…

nginx-error-log

Howto resolve nginx proxy manager failed to renew ssl

  I’ve been using Nginx Proxy Manager for a couple of years now. It provides free SSL with Let’s Encrypt, is designed with security in mind, and…

embracing-ai-in-the-workplace

Embracing AI in the Workplace: A Guide for Professionals

Hello, professionals of all ages and experience levels! Are you ready to dive into the exciting world of AI at work? Whether you’re a seasoned veteran or…

people coding using ai

How to Use Google Trends to Your Advantage

Hey there, trendsetters and curious minds! Have you ever wondered what the world is buzzing about online? Well, Google Trends is your backstage pass to the hottest…

data-access-management

Understanding and Implementing Data Access Management

Managing who has access to your company’s data is crucial for keeping it safe from unauthorized use. Data access management is all about using methods like password…

Discover more from Susiloharjo

Subscribe now to keep reading and get access to the full archive.

Continue reading