Login

Navigation

This articles is published 503 days ago and last updated 489 days ago, some information may be out of date.

2023-03-06_165215.png

Preface:

Let NPM (Nginx Proxy Manager) and FRP (Fast Reverse Proxy) share 80/443 ports with wildcard domain name

Configuration:

frps.ini config

since NPM occupies port 80/443, and then in frps.ini please replace with a different port. such as: 1080/1443
[common]
bind_addr = 0.0.0.0
bind_port = 17000
vhost_http_port = 1080
vhost_https_port = 1443

# dashboard TLS mode
dashboard_tls_mode = false

authentication_method = token
authenticate_heartbeats = false
authenticate_new_work_conns = false
token = yM1nDMBFihB93zs376uR

# pool_count in each proxy will change to max_pool_count if they exceed the maximum value
max_pool_count = 5

# max ports can be used for each client, default value is 0 means no limit
max_ports_per_client = 0

# tls_only specifies whether to only accept TLS-encrypted connections. By default, the value is false.
tls_only = false

# if subdomain_host is not empty, you can set subdomain when type is http or https in frpc's configure file
subdomain_host = kingtam.win

# Enable golang pprof handlers in dashboard listener.
# Dashboard port must be set first
pprof_enable = false

frpc.ini config

If Wildcard Domain Name is configured, then the Domain Name parameter in Fill in only the second-level domain name header. e.g. subdomain = navi
[common]
server_addr = frps.kingtam.win
server_port = 17000
token = yM1nDMBFihB93zs376uR

pool_count = 5

tcp_mux = true

user = OneCloud

login_fail_exit = false

protocol = tcp

tls_enable = true

[navi]
type = http
subdomain = navi
local_ip = 127.0.0.1
local_port = 5005

Moreover, If Wildcard Domain Name is not configured, then the Domain Name parameter in Requires a complete domain name. e.g. custom_domains = navi.kingtam.win instead of subdomain = navi

DNS management for Wildcard Domain Name (kingtam.win)

image-20230307120041855.png

NPM config

NPM reverse FRPS port 1080 to HTTPS with wildcard domain (*.kingtam.win)

image-20230306164838962.png

image-20230306164323507.png

  • proxy_pass http://127.0.0.1:1080; , written as .HTTP Never HTTPS , and the port 1080 is refer from frps.ini vhost_http_port = 1080
  • proxy_set_header Host $host:80; Note that port 80 needs to be added, causing the web page to fail to open and prompting too many redirects ERR_TOO_MANY_REDIRECTS.
    location / {
        proxy_pass http://127.0.0.1:1080;
        proxy_redirect off;
        proxy_set_header Host $host:80;
        proxy_ssl_server_name on;
        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;
    }

Result:

After each configuration is completed, the result is as shown on the screen.

image-20230306164133340.png


Reference:


Related: