How to add Custom Locations in Nginx Proxy Manager

Published

After installing Coolify on my homelab and proxying it with Nginx Proxy Manager (NPM), I ran into an issue. Even with WebSockets Support enabled, I kept getting warnings in the UI and browser console about failed WebSocket connections.

The problem was that Coolify uses different routes and ports for WebSockets, and configuring NPM to handle this correctly isn’t obvious.

Here’s how to properly set up custom locations in NPM when you need them:

Basic Setup

  1. First, create your proxy host with the main website configuration
  2. Enable WebSockets in the main configuration if needed
  3. Add custom locations for specific paths requiring special handling

Adding WebSocket Custom Locations

From your proxy host details page, click “Custom Locations” and then “Add Location” :

Configure the Basic Fields

  • Location: Enter the path (e.g., /app or /terminal/ws)
  • Scheme: Select http (or https if your backend uses SSL)
  • Forward Hostname / IP: Enter the IP address only (e.g., 192.168.1.12)
    • that is, without the path used in location
  • Forward Port: Enter the specific port for this path (e.g., 6001)

Configure Advanced Settings

In the text area that shows up after clicking the gear icon, you must include the complete location block configuration.

location /your-path {
    proxy_pass http://your-ip:your-port;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $host;
    proxy_read_timeout 86400;
}

You’d expect the textarea’s contents to be inserted in the block generated from the mandatory inputs, but that won’t work. Don’t ask me why.

Coolify example

Coolify has two different WebSocket paths:

For /app WebSocket:

  • Location: /app
  • Scheme: http
  • Forward IP: 192.168.1.12
  • Port: 6001
  • Advanced Config:
location /app {
    proxy_pass http://192.168.1.12:6001;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $host;
    proxy_read_timeout 86400;
}

For /terminal/ws WebSocket:

  • Location: /terminal/ws
  • Scheme: http
  • Forward IP: 192.168.1.12
  • Port: 6002
  • Advanced Config:
location /terminal/ws {
    proxy_pass http://192.168.1.12:6002;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $host;
    proxy_read_timeout 86400;
}

Troubleshooting

  • If your proxy shows offline, check the generated Nginx configuration. You’ll find them under /data/nginx/proxy_host. Numbers will match what’s in the UI.
  • Check your firewall configuration with ss -tuln. The application ports you’re trying to proxy should be in the list.
  • Ensure that the location path in the Advanced tab exactly matches the Location field