[GH-ISSUE #3636] Adding a simple config makes the proxy host offline #2411

Closed
opened 2026-02-26 07:35:27 +03:00 by kerem · 7 comments
Owner

Originally created by @Asynchronite on GitHub (Mar 18, 2024).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3636

I'll keep this plain and simple.
I added a simple proxy host with the following advanced config;

server {
       listen 81;
       listen [::]:81;

       server_name example.example.com;

       root /var/www/example;
       index index.html;

       location / {
               try_files $uri $uri/ =404;
       }
}

And when I saved the config, the proxy host status just says offline.

Originally created by @Asynchronite on GitHub (Mar 18, 2024). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/3636 I'll keep this plain and simple. I added a simple proxy host with the following advanced config; ``` server { listen 81; listen [::]:81; server_name example.example.com; root /var/www/example; index index.html; location / { try_files $uri $uri/ =404; } } ``` And when I saved the config, the proxy host status just says offline.
kerem 2026-02-26 07:35:27 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@Asynchronite commented on GitHub (Mar 18, 2024):

Even if I remove the server {} part it just gives me a 404 error.

<!-- gh-comment-id:2005076244 --> @Asynchronite commented on GitHub (Mar 18, 2024): Even if I remove the server {} part it just gives me a 404 error.
Author
Owner

@wolviex commented on GitHub (Mar 20, 2024):

Do you mean the advanced config/Custom Nginx Configuration as set in the web gui?
That custom config will just drop in above the location tag on the actual nginx config file. NPM does the rest, so you wouldn't put in any of the other stuff. The only part you could specify is:
root /var/www/example; index index.html;

Or are you creating a completely new .conf file and dropping it in the proxy_host directory?
In that case a 404 suggests that the file you're trying to access doesn't exist.
going to /foo will look for either a file named /var/www/example/foo, an index in the directory /var/www/example/foo/, or the directory /foo/ (if you have autoindex enabled).
But that's not an NPM question, it's an nginx question. Nginx Docs

<!-- gh-comment-id:2009901150 --> @wolviex commented on GitHub (Mar 20, 2024): Do you mean the advanced config/Custom Nginx Configuration as set in the web gui? That custom config will just drop in above the location tag on the actual nginx config file. NPM does the rest, so you wouldn't put in any of the other stuff. The only part you could specify is: ` root /var/www/example; index index.html;` Or are you creating a completely new .conf file and dropping it in the proxy_host directory? In that case a 404 suggests that the file you're trying to access doesn't exist. going to /foo will look for either a file named /var/www/example/foo, an index in the directory /var/www/example/foo/, or the directory /foo/ (if you have autoindex enabled). But that's not an NPM question, it's an nginx question. [Nginx Docs](https://nginx.org/en/docs/http/ngx_http_core_module.html#try_files)
Author
Owner

@Asynchronite commented on GitHub (Mar 22, 2024):

@wolviex
Hello, I was looking at the wrong config, however, I had to remove server {} and it fixed that config (for some reason).
Now, the real config is as follows (it's a bit lengthy)

server {
    server_name guardsman.astrohweston.xyz;


    root /opt/guardsman-web/public;
    index index.html index.htm index.php;
    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
        expires 1y;
        add_header Cache-Control "public, no-transform";
        add_header Accept-Encoding "gzip, compress, br";
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/guardsman.log error;

    location /api/* {
        expires -1;
        add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
    }

    location /openapi.json {
        expires -1;
        add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
    }

    location /statistics.json {
        expires -1;
        add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
    }

    #GZIP
    # Enable gzip compression.
    gzip on;

    # Compression level (1-9).
    # 5 is a perfect compromise between size and CPU usage, offering about
    # 75% reduction for most ASCII files (almost identical to level 9).
    gzip_comp_level    5;

    # Don't compress anything that's already small and unlikely to shrink much
    # if at all (the default is 20 bytes, which is bad as that usually leads to
    # larger files after gzipping).
    gzip_min_length    256;

    # Compress data even for clients that are connecting to us via proxies,
    # identified by the "Via" header (required for CloudFront).
    gzip_proxied       any;

    # Tell proxies to cache both the gzipped and regular version of a resource
    # whenever the client's Accept-Encoding capabilities header varies;
    # Avoids the issue where a non-gzip capable client (which is extremely rare
    # today) would display gibberish if their proxy gave them the gzipped version.
    gzip_vary          on;

    # Compress all output labeled with one of the following MIME-types.
    gzip_types
      application/atom+xml
      application/javascript
      application/json
      application/ld+json
      application/manifest+json
      application/rss+xml
      application/vnd.geo+json
      application/vnd.ms-fontobject
      application/x-font-ttf
      application/x-web-app-manifest+json
      application/xhtml+xml
      application/xml
      font/opentype
      image/bmp
      image/svg+xml
      image/x-icon
      text/cache-manifest
      text/css
      text/plain
      text/vcard
      text/vnd.rim.location.xloc
      text/vtt
      text/x-component
      text/x-cross-domain-policy;
    # text/html is always compressed by gzip module

    # allow larger file uploads and longer script runtimes
    client_max_body_size 100m;
    client_body_timeout 120s;

    sendfile off;

    location /api/docs {
        proxy_pass http://127.0.0.1:9001;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTP_PROXY "";
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
    }

    location ~ /\.ht {
        deny all;
    }
}

The above config file has been edited so it doesn't require an SSL cert. I'm assuming I can add when I'm making a proxy host?
In any case, even when I add this, it just says that it's offline. Again, I removed the server {} part of the config, and it showed it online. However, when I opened the website, it have me a 502 error. I then added an SSL certificate in the proxy manager, and it still would not work and would just give me a 502 error. From what I've gathered from a normal Nginx instance, I wouldn't need to run any of the files in order to get my site up.
But now, I don't know so I'd really appreciate any help that can be given, thank you!

<!-- gh-comment-id:2015177403 --> @Asynchronite commented on GitHub (Mar 22, 2024): @wolviex Hello, I was looking at the wrong config, however, I had to remove server {} and it fixed that config (for some reason). Now, the real config is as follows (it's a bit lengthy) ``` server { server_name guardsman.astrohweston.xyz; root /opt/guardsman-web/public; index index.html index.htm index.php; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; expires 1y; add_header Cache-Control "public, no-transform"; add_header Accept-Encoding "gzip, compress, br"; } location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found off; } access_log off; error_log /var/log/nginx/guardsman.log error; location /api/* { expires -1; add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; } location /openapi.json { expires -1; add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; } location /statistics.json { expires -1; add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; } #GZIP # Enable gzip compression. gzip on; # Compression level (1-9). # 5 is a perfect compromise between size and CPU usage, offering about # 75% reduction for most ASCII files (almost identical to level 9). gzip_comp_level 5; # Don't compress anything that's already small and unlikely to shrink much # if at all (the default is 20 bytes, which is bad as that usually leads to # larger files after gzipping). gzip_min_length 256; # Compress data even for clients that are connecting to us via proxies, # identified by the "Via" header (required for CloudFront). gzip_proxied any; # Tell proxies to cache both the gzipped and regular version of a resource # whenever the client's Accept-Encoding capabilities header varies; # Avoids the issue where a non-gzip capable client (which is extremely rare # today) would display gibberish if their proxy gave them the gzipped version. gzip_vary on; # Compress all output labeled with one of the following MIME-types. gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; # text/html is always compressed by gzip module # allow larger file uploads and longer script runtimes client_max_body_size 100m; client_body_timeout 120s; sendfile off; location /api/docs { proxy_pass http://127.0.0.1:9001; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/run/php/php8.3-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M"; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param HTTP_PROXY ""; fastcgi_intercept_errors off; fastcgi_buffer_size 16k; fastcgi_buffers 4 16k; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; } location ~ /\.ht { deny all; } } ``` The above config file has been edited so it doesn't require an SSL cert. I'm assuming I can add when I'm making a proxy host? In any case, even when I add this, it just says that it's offline. Again, I removed the `server {}` part of the config, and it showed it online. However, when I opened the website, it have me a 502 error. I then added an SSL certificate in the proxy manager, and it still would not work and would just give me a 502 error. From what I've gathered from a normal Nginx instance, I wouldn't need to run any of the files in order to get my site up. But now, I don't know so I'd really appreciate any help that can be given, thank you!
Author
Owner

@Asynchronite commented on GitHub (Mar 22, 2024):

My configuration is pointing towards port 80, which was in the config file but I removed it and just added it to the proxy host instead.

<!-- gh-comment-id:2015179169 --> @Asynchronite commented on GitHub (Mar 22, 2024): My configuration is pointing towards port 80, which was in the config file but I removed it and just added it to the proxy host instead.
Author
Owner

@wolviex commented on GitHub (Mar 23, 2024):

If you're manually editing the nginx configuration files then this isn't an NPM question, this is an nginx question. Nginx Docs

The fact that you're specifying a root with index suggests that this is not a proxy host, it only has proxy subdirectories.

What part of this are you creating with NginxProxyManager?

<!-- gh-comment-id:2016356122 --> @wolviex commented on GitHub (Mar 23, 2024): If you're manually editing the nginx configuration files then this isn't an NPM question, this is an nginx question. [Nginx Docs](https://nginx.org/en/docs/http/ngx_http_core_module.html#try_files) The fact that you're specifying a root with index suggests that this is not a proxy host, it only has proxy subdirectories. What part of this are you creating with NginxProxyManager?
Author
Owner

@Asynchronite commented on GitHub (Mar 25, 2024):

Hey, can you ellaborate what you mean by what part?
Thank you!

<!-- gh-comment-id:2018510441 --> @Asynchronite commented on GitHub (Mar 25, 2024): Hey, can you ellaborate what you mean by what part? Thank you!
Author
Owner

@wolviex commented on GitHub (Mar 25, 2024):

What part of this configuration are you creating with Nginx Proxy Manager, in the WebUI?

What Docker Image are you using here?

<!-- gh-comment-id:2018516995 --> @wolviex commented on GitHub (Mar 25, 2024): What part of this configuration are you creating with Nginx Proxy Manager, in the WebUI? **What Docker Image are you using here?**
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#2411
No description provided.