NginxProxyManager / nginx-proxy-manager

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

Add custom location for proxy host --> server goes offline #3512

Open KingJim1984 opened 9 months ago

KingJim1984 commented 9 months ago

Checklist

Describe the bug

Hello,

I create a new entry:

grafik

add custom location

grafik

after klicking to save

grafik

Nginx Proxy Manager Version

2.11.1

Operating System

Ubuntu 22.04.3 LTS

aemonculaba commented 9 months ago

Yep, same problem!

jucajuca commented 9 months ago

same, this app is just broken

sfn-git commented 9 months ago

Ran into this problem as well and looks like its related to this issue (link is to the solution).

KingJim1984 commented 9 months ago

Ran into this problem as well and looks like its related to this issue (link is to the solution).

This solution works fine for me ;)

shanelord01 commented 8 months ago

Ran into this problem as well and looks like its related to this issue (link is to the solution).

This solution works fine for me ;)

Not working for me. Hoping a permanent fix is incoming?

MeesJ commented 8 months ago

jc21/nginx-proxy-manager:github-pr-3478 (#3478) should fix this. Hopefully this'll be introduced in the production image soon!

sueess86 commented 8 months ago

since the latest update I have the same issue with custom locations. It brings the site offline.

AkshayRao27 commented 8 months ago

I am running Nginx Proxy Manager 2.11.1 in a Debian 12 LXC Container in Proxmox 8.1.4 via the Proxmox Helper Scripts. This is what fixed the issue for me.

  1. Delete the very first line {% include "_hsts_map.conf" %} from the /app/templates/_locations.conf file.
  2. Reboot the LXC Container (maybe doing systemctl restartnpm.service in the console of the container could be enough as well)
  3. Delete the Custom location & re-add it
  4. Host is now online, and the custom location works regardless of the state of the HSTS toggles.

image

I was initially a little stupid and deleted the line from /data/logs/nginx-proxy-manager-2.11.1/backend/templates/_locations.conf file and was frustrated that it still wasn't working. Don't be me - wait for your FTP Program's Search function to finish 🙃

If you are running NPM in a Docker Container or on some other kind of system, you will just need to find the correct file (I am not sure if the file/folder structure is different when you deploy in Docker or TrueNAS or what have you).

hans-holgersson commented 8 months ago

I have the same problem with "custom location". I am using NPM 2.11.1 dockerized version. This trick solves the problem - at least for now.

tobiasredel commented 8 months ago

Same problem here with any custom locations

randbytes commented 8 months ago

Same here with custom location

Dome2075 commented 8 months ago

Also same problem

AkshayRao27 commented 8 months ago

Have you guys tried the workaround in https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3512#issuecomment-1940868886? It seems to be working for a lot of people.

namph-hanoi commented 8 months ago

The workaround not working for me 🙂

AkshayRao27 commented 8 months ago

The workaround not working for me 🙂

What are you using it on? Docker? Something else? Maybe someone with a similar setup might be able to help. I read on a different post about this same issue that someone deployed a specific pull request and that worked for their docker setup.

Dome2075 commented 8 months ago

I'm using docker. I have no option to modify .config. Or is there? I tried to edit with nano but not installed.

AkshayRao27 commented 8 months ago

You could try using something like winscp and then editing the file with whatever program you have on your system like notepad++ or sublime text.

That's how I ended up doing it. I don't trust myself to not screw things up in the console 😅

Dome2075 commented 8 months ago

Please helping me.

How can I connect with winscp into a docker Container?

AkshayRao27 commented 8 months ago

Sorry, as I mentioned in my original comment I'm using a Proxmox LXC, so I can't really give you much advice here. I'm a beginner myself.

That said, it might not be THAT different from Proxmox. All I had to do was to enter my Proxmox LXC container's IP address in winscp, and use root as the username and my root password, and it connected. Then I just ran a file search for that _locations file. If you're running docker on a Linux machine or something of the sort, this might work for you.

If this doesn't, you might need to look this up.

Dome2075 commented 8 months ago

@AkshayRao27 Connecting into docker container with sst not working for me :(

so workaruond not possible

AkshayRao27 commented 8 months ago

Connecting into docker container with sst not working for me :(

so workaruond not possible

Someone else with a docker setup managed to get it working - maybe try it this way or then ask them if they could help? https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3536#issuecomment-1950055135

alhazmy13 commented 8 months ago

I am running Nginx Proxy Manager 2.11.1 in a Debian 12 LXC Container in Proxmox 8.1.4 via the Proxmox Helper Scripts. This is what fixed the issue for me.

  1. Delete the very first line {% include "_hsts_map.conf" %} from the /app/templates/_locations.conf file.
  2. Reboot the LXC Container (maybe doing systemctl restartnpm.service in the console of the container could be enough as well)
  3. Delete the Custom location & re-add it
  4. Host is now online, and the custom location works regardless of the state of the HSTS toggles.

image

I was initially a little stupid and deleted the line from /data/logs/nginx-proxy-manager-2.11.1/backend/templates/_locations.conf file and was frustrated that it still wasn't working. Don't be me - wait for your FTP Program's Search function to finish 🙃

If you are running NPM in a Docker Container or on some other kind of system, you will just need to find the correct file (I am not sure if the file/folder structure is different when you deploy in Docker or TrueNAS or what have you).

I can confirm this is NOT solving the issue

remy33 commented 8 months ago

I tried a little to investigate this issue a little. I played with the config as well as applied https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3512#issuecomment-1940868886 This worked only for the exact path, all sub-paths such as /test/test.js are ignored location /test/ { proxy_pass http://192.168.1.2:1111/; }

This made the application gone offline, but after I applied @AkshayRao27 's solution it worked!

location ^~ /test/ {
    proxy_pass http://192.168.1.2:1111/;
  }

Note that I couldn't make the regexes to work before I applied the solution.

hans-holgersson commented 8 months ago

Hi, i forgot to mention: i am using NPM dockerized version. You can get inside the docker container with command:

docker exec -it nginxproxymanager-app-1 /bin/bash

where nginxproxymanager-app-1 is the name of the container.

You can not get in with ssh or scp because there is no ssh server running in that container, you may install it, but it is nonsense.

electricxray commented 8 months ago

For those attempting to modify your number.conf, keep in mind that there may not be a text editor installed already for those using a docker or podman container. I was able to edit that conf file by moving it into the /data dir within the container which is mounted to wherever you mounted that to on the host OS. The following commands helped me, even though ultimately, editing that conf file did not resolve my issue. If you are using docker, replace my podman with docker and you may or may not need sudo, and replace NPM with the name of your Nginx Proxy Manager container. podman exec -it NPM /bin/bash cd /app/templates/ cp _locations.conf _locations.conf.bak mv _locations.conf /data Exit your container shell or open another terminal into your server At this point, you can use your favorite text editor to edit that file wherever your mount point is on the host OS After deleted that first line, you can then move the file back in your container's shell with the following mv /data/_location.conf /app/templates/_location.conf I'd hold onto that .bak backup to be safe. Sorry for the long winded comment. First time weighing in, I'm just dipping my toes into the reverse proxy world and wanted to help more novice users

RainmakerRaw commented 8 months ago

I'm hitting this issue too, and the file edits don't help.

Chiller2019 commented 8 months ago

That fixed for me on a Docker-Container. Hope for a fast Fix ..

JurgenCruz commented 7 months ago

How do you restart the service after updating the file? if you restart the container wouldn't the changes get lost since it is not a volume?

hans-holgersson commented 7 months ago

Copy out the directories where the service keeps its config files, after that mount them in container as a volume. In this way the config won't be lost.

SmallStrayFox commented 7 months ago

jc21/nginx-proxy-manager:github-pr-3478 (#3478) should fix this. Hopefully this'll be introduced in the production image soon!

changed my docker compose to use this and this fixed the problem.

fearandesire commented 7 months ago

I am running Nginx Proxy Manager 2.11.1 in a Debian 12 LXC Container in Proxmox 8.1.4 via the Proxmox Helper Scripts. This is what fixed the issue for me.

  1. Delete the very first line {% include "_hsts_map.conf" %} from the /app/templates/_locations.conf file.

  2. Reboot the LXC Container (maybe doing systemctl restartnpm.service in the console of the container could be enough as well)

  3. Delete the Custom location & re-add it

  4. Host is now online, and the custom location works regardless of the state of the HSTS toggles.

image

I was initially a little stupid and deleted the line from /data/logs/nginx-proxy-manager-2.11.1/backend/templates/_locations.conf file and was frustrated that it still wasn't working. Don't be me - wait for your FTP Program's Search function to finish 🙃

If you are running NPM in a Docker Container or on some other kind of system, you will just need to find the correct file (I am not sure if the file/folder structure is different when you deploy in Docker or TrueNAS or what have you).

Thank you so much, this worked for me. For some reason, the only variation for me was that it was _location.conf, not plural. I rebooted my container after removing the first line, and it works as intended.

PronPan commented 7 months ago

I am running Nginx Proxy Manager 2.11.1 in a Debian 12 LXC Container in Proxmox 8.1.4 via the Proxmox Helper Scripts. This is what fixed the issue for me.

1. Delete the very first line `{% include "_hsts_map.conf" %}` from the `/app/templates/_locations.conf file`.

2. Reboot the LXC Container (maybe doing `systemctl restartnpm.service` in the console of the container could be enough as well)

3. Delete the Custom location & re-add it

4. Host is now online, and the custom location works regardless of the state of the HSTS toggles.

image

I was initially a little stupid and deleted the line from /data/logs/nginx-proxy-manager-2.11.1/backend/templates/_locations.conf file and was frustrated that it still wasn't working. Don't be me - wait for your FTP Program's Search function to finish 🙃

If you are running NPM in a Docker Container or on some other kind of system, you will just need to find the correct file (I am not sure if the file/folder structure is different when you deploy in Docker or TrueNAS or what have you).

Thank you! Spent hours trying to fix this and your solution worked for me. I am using Docker on Windows and like @fearandesire, my file was /app/templates/_location.conf without the "s' in locations.conf. It just took a restart of the container and my hosts are now connecting correctly.

CarbonNeuron commented 7 months ago

I did some research and found that you can automate removing that line with the sed command, and since this container is using the s6-overlay, you can provide additional commands to run with the docker-compose command YML entry. However, this command needs to run forever, otherwise s6 will see that is has stopped and restart the container services. Here is what I added to my docker-compose app to get it to remove that line on startup, and then block forever:

command: bash -c "sed -i '/{% include \"_hsts_map.conf\" %}/d' /app/templates/_location.conf; while true; do sleep 86400; done"

This doesn't really consume any more CPU since it is sleeping for 86400 seconds, but it does block the command from exiting. Adding this line fixes the issue using the workaround, and allows you to drop the container and recreate it without having to manually exec that command.

republicandaddy commented 6 months ago

I am running Nginx Proxy Manager 2.11.1 in a Debian 12 LXC Container in Proxmox 8.1.4 via the Proxmox Helper Scripts. This is what fixed the issue for me.

  1. Delete the very first line {% include "_hsts_map.conf" %} from the /app/templates/_locations.conf file.
  2. Reboot the LXC Container (maybe doing systemctl restartnpm.service in the console of the container could be enough as well)
  3. Delete the Custom location & re-add it
  4. Host is now online, and the custom location works regardless of the state of the HSTS toggles.

image

I was initially a little stupid and deleted the line from /data/logs/nginx-proxy-manager-2.11.1/backend/templates/_locations.conf file and was frustrated that it still wasn't working. Don't be me - wait for your FTP Program's Search function to finish 🙃

If you are running NPM in a Docker Container or on some other kind of system, you will just need to find the correct file (I am not sure if the file/folder structure is different when you deploy in Docker or TrueNAS or what have you).

This was PERFECT for me. I am running it as LXC on Proxmox 8.1 too. An immediate fix. Thank you for the help!

hoangtran355 commented 6 months ago

I am running Nginx Proxy Manager 2.11.1 in a Debian 12 LXC Container in Proxmox 8.1.4 via the Proxmox Helper Scripts. This is what fixed the issue for me.

1. Delete the very first line `{% include "_hsts_map.conf" %}` from the `/app/templates/_locations.conf file`.

2. Reboot the LXC Container (maybe doing `systemctl restartnpm.service` in the console of the container could be enough as well)

3. Delete the Custom location & re-add it

4. Host is now online, and the custom location works regardless of the state of the HSTS toggles.

image

I was initially a little stupid and deleted the line from /data/logs/nginx-proxy-manager-2.11.1/backend/templates/_locations.conf file and was frustrated that it still wasn't working. Don't be me - wait for your FTP Program's Search function to finish 🙃

If you are running NPM in a Docker Container or on some other kind of system, you will just need to find the correct file (I am not sure if the file/folder structure is different when you deploy in Docker or TrueNAS or what have you).

This fixes the issue for me. Thank you a lot

LucasJanin commented 6 months ago
1. Delete the very first line `{% include "_hsts_map.conf" %}` from the `/app/templates/_locations.conf file`.
2. Reboot the LXC Container (maybe doing `systemctl restartnpm.service` in the console of the container could be enough as well)
3. Delete the Custom location & re-add it
4. Host is now online, and the custom location works regardless of the state of the HSTS toggles.

Work for me too, thanks !!!

leonardosantoslopes commented 3 weeks ago

Hello guys,

I see some people struggling to configure their sub-domains along with url path.

Please find below the right way to do:

Click on "Hosts" --> Proxy Hosts --> Add Proxy Host:

image image

On the "New Proxy Host" under "Details" tab, fill up with your sub-domain, IP and Port:

image

Under the "Custom Locations" tab fill up as following:

image

So, under the location "/" --> and under "Forward Hostname / IP" you put your IP address and the desired path ending by "/":

e.g.: 10.10.10.1/MYPATH/

I hope it helps everyone which is suffering by this missing documented step-by-step.

Regards, Leo

hans-holgersson commented 2 weeks ago

hi @leonardosantoslopes. which version of npm are running?

leonardosantoslopes commented 2 weeks ago

Hi @hans-holgersson,

I'm using the latest docker version from @jc21. ==> By the way, thanks @jc21 for such project.

URL: https://hub.docker.com/r/jc21/nginx-proxy-manager

Hereunder a screenshot of the current installed version:

image

Regards, Leo

hans-holgersson commented 2 weeks ago

myeah ... my version is 2.11.1 i will update my npm, and will see what happens. btw: did you upgrade from an older version or 2.11.3 is the first install?

10x hans.

leonardosantoslopes commented 2 weeks ago

My current setup is a fresh install from latest docker image. Leo

hans-holgersson commented 2 weeks ago

so i did it. upgrade from 2.11.1 to 2.11.2 by docker pull and docker start is working as stated on "https://nginxproxymanager.com/upgrading/" but upgrade from 2.11.2 to 2.11.3 does not work. it throws the following errors:

`nginx: [warn] the "listen ... http2" directive is deprecated, use the "http2" directive instead in /data/nginx/proxy_host/13.conf:19 nginx: [warn] protocol options redefined for 0.0.0.0:443 in /data/nginx/proxy_host/13.conf:19

the "listen ... http2" directive is deprecated, use the "http2" directive instead in /data/nginx/redirection_host/3.conf:15

nginx: [alert] failed to load the 'resty.core' module (https://github.com/openresty/lua-resty-core); ensure you are using an OpenResty release from https://openresty.org/en/download.html (reason: /etc/nginx/lualib/resty/core/base.lua:24: ngx_http_lua_module 0.10.25 required) in /etc/nginx/nginx.conf:87

etc ...`

any idea about it?

tomorrow i'll open a bugreport on this issue.