NginxProxyManager / nginx-proxy-manager

Docker container for managing Nginx proxy hosts with a simple, powerful interface
https://nginxproxymanager.com
MIT License
23.03k stars 2.67k forks source link

How to redirect traffic on port 443 in NPM? #996

Open talesam opened 3 years ago

talesam commented 3 years ago

I can only run services on npm with applications that already have a web server attached, otherwise I can't. I would like an example, how do I run a common application that needs a web server, in case I want to use npm as a web server.

For example. I have an application and if it were directly on the host I would configure it like this on nginx:

https://blog.hexor.ru/arch-linux-repository/

How do I set this up at npm?

server {
    server_name repo.sun.hexor.ru;
    listen [::]:443 ssl;
    listen 443 ssl;
    include security.conf;
    include letsencrypt.conf;
    root /srv/arch-repo;
    location / {
        autoindex on;
        try_files $uri $uri/ =404;
    }
    access_log /var/log/nginx/logs/repo.sun.hexor.ru.access.log custom;
    error_log /var/log/nginx/logs/repo.sun.hexor.ru.error.log;
}
p-fruck commented 3 years ago

Little bit late of a reply, but I used the following setup to match this scenario: I've used a standalone apache server to host multiple pages, eg:

Now setup some proxy host for your domains, eg. page1.example.com, page2.example.com

As a forward name, you can provide anything, eg. custom_location. This will only matter if you use antoher subfolder than /. Under Custom Locations, you redirect the subfolder / to http://apache/page1. You have now successfully redirected your subdomains to a statically served subfolder :tada:

Attention: Currently there is an issue forcing ssl redirection. A fix has already been merged into development, but is not yet ready production. You can however use the fix documented here

talesam commented 3 years ago

I thought I didn’t express myself well above, basically what I want is a port redirect ..

Example.. I have a proxy server (v2ray) running on port 8443, in docker, that is: 8443: 443, being host: container.

Port 8443 is open on the firewall and the client has a configuration file that points to port 8443.

What I want is for the client to have port 443 in the configuration file (which is used by the NPM), but for the NPM to be able to redirect traffic from the client to port 8443 to communicate with the server.

p-fruck commented 3 years ago

Ok, as far as I've understood this is a totally different question than your first one. If I understand you correctly, your planning to do some kind of TCP forwarding to another service. I'm probably not qualified to give you a satisfying answer, but as far as I know NPM will only allow http/s forwarding on the default ports (80/443). You can however use the integrated streams feature. This will allow you to open up a different port to TCP forward to your proxy. But as far as I know, you're not able to use the NPM to forward http/s traffic and other TCP requests on the same port. At least not by default.

talesam commented 3 years ago

The referral I need is precisely at port 443, that is:

External client (calls port 443) ----> (Request arrives at NPM on port 443) ----> (NPM Forwards to a specific port in an internal container)

(Cliente: port 443) <------------> (NPM: port 443) <------------> (Proxy: port 2000)

Adu-3 commented 2 years ago

Let me know if you find any solution , I have the same exact problem

I have tried to stream to other ports and it works , However when I try to open it on 443 or 80 the container admin page goes down .

and even if you reinstalled the container on the same volume it will not wok , you have to either remove the volume or modify the files manually .

github-actions[bot] commented 8 months ago

Issue is now considered stale. If you want to keep it open, please comment :+1: