Code Monkey home page Code Monkey logo

Comments (20)

kylethedeveloper avatar kylethedeveloper commented on May 17, 2024 18

Hi everyone,
I agree that this should be implemented in the UI but until then, I wanted to explain how I managed to do it so that you can too.


Create a directory named error_pages under your /data/nginx/ directory. Prepare your custom error pages and put them in there. These files will be persistent as I suppose that you mount /data directory to your host machine.

After restarting your container; visit the dashboard, edit a proxy host, go to Advanced tab and paste the following with respect to the name of your error page file:

# Error page for 50x
error_page 500 502 503 504  /error-cloud.html;
proxy_intercept_errors on;
location /error-cloud.html {
internal;
root /data/nginx/error_pages;
}

In this case, my error page filename is error-cloud.html where HTTP code is one of 500, 502, 503 or 504.

You can prepare different error pages for different hosts and also different error pages for different response codes. Hope this is helpful.

from nginx-proxy-manager.

eremid avatar eremid commented on May 17, 2024 6

You can add a file server_proxy.conf in your /data/nginx/custom with your content example to set the custom error page globaly :

error_page 400 /error_pages/HTTP400.html;
error_page 401 /error_pages/HTTP402.html;
error_page 402 /error_pages/HTTP402.html;
error_page 403 /error_pages/HTTP403.html;
error_page 404 /error_pages/HTTP404.html;
error_page 500 /error_pages/HTTP500.html;
error_page 501 /error_pages/HTTP501.html;
error_page 502 /error_pages/HTTP502.html;
error_page 503 /error_pages/HTTP503.html;
proxy_intercept_errors on;

location /error_pages/ {
    alias /data/nginx/error_pages/;
    internal;
}

Or comment proxy_intercept_errors on; and just add this directive in the proxy host advanced configuration.

from nginx-proxy-manager.

ririko5834 avatar ririko5834 commented on May 17, 2024 2

Its good idea to add way to setup custom html error pages for HTTP error codes, for example I want to replace this
image with my own.

from nginx-proxy-manager.

webysther avatar webysther commented on May 17, 2024 2

Using HttpErrorPages with the solution of @kylethedeveloper:

location / {
    # ... all other configuration
    error_page 400 /error_pages/HTTP400.html;
    error_page 401 /error_pages/HTTP402.html;
    error_page 402 /error_pages/HTTP402.html;
    error_page 403 /error_pages/HTTP403.html;
    error_page 404 /error_pages/HTTP404.html;
    error_page 500 /error_pages/HTTP500.html;
    error_page 501 /error_pages/HTTP501.html;
    error_page 502 /error_pages/HTTP502.html;
    error_page 503 /error_pages/HTTP503.html;
    proxy_intercept_errors on;
}

location /error_pages/ {
    alias /data/nginx/error_pages/;
    internal;
}

This maybe can be the default inside NPM + HttpErrorPages @jc21

from nginx-proxy-manager.

Daxx13 avatar Daxx13 commented on May 17, 2024
default page when no matching hostname is configured

+1 to this, will be a great enhancement.

from nginx-proxy-manager.

fauzie avatar fauzie commented on May 17, 2024

+1

Waiting for this.

from nginx-proxy-manager.

didusee avatar didusee commented on May 17, 2024

+1

from nginx-proxy-manager.

ghallford avatar ghallford commented on May 17, 2024

I would like the option to have the default page when no hostname is specified return just a 404 error message. Or just make it so that if anything is hit that is not a valid hostname proxy, it returns a 404 including if the default page is hit from the client using IP of the server in the URL

from nginx-proxy-manager.

tophee avatar tophee commented on May 17, 2024

+1

Sorry if this is a dumb question, but what is currently the best work around for not exposing that page saying "Congratulations! You've successfully started the Nginx Proxy Manager"? My quick solution was to create a redirect host for my bare IP and redirect to some public website. So Whoever visits my IP will just be bounced back into the internet... :-)

from nginx-proxy-manager.

aosmirnov avatar aosmirnov commented on May 17, 2024

It would be nice to allow the user to specify the content for the following pages

  • upstream 404
  • upstream 500
  • upstream unavailable error
  • default page when no matching hostname is configured

This feature is really needful!

from nginx-proxy-manager.

Mohan-cloud avatar Mohan-cloud commented on May 17, 2024

@tophee Is redirection to a public site still the best solution?

from nginx-proxy-manager.

l4rm4nd avatar l4rm4nd commented on May 17, 2024

@jc21 any updates or plans on this feature enhancement?

from nginx-proxy-manager.

PrzemekSkw avatar PrzemekSkw commented on May 17, 2024

+1

Sorry if this is a dumb question, but what is currently the best work around for not exposing that page saying "Congratulations! You've successfully started the Nginx Proxy Manager"? My quick solution was to create a redirect host for my bare IP and redirect to some public website. So Whoever visits my IP will just be bounced back into the internet... :-)

Hello, I also see that Congratulations page on my external IP. Can You tell how to make that redirection?
Regards.

from nginx-proxy-manager.

aosmirnov avatar aosmirnov commented on May 17, 2024

+1
Sorry if this is a dumb question, but what is currently the best work around for not exposing that page saying "Congratulations! You've successfully started the Nginx Proxy Manager"? My quick solution was to create a redirect host for my bare IP and redirect to some public website. So Whoever visits my IP will just be bounced back into the internet... :-)

Hello, I also see that Congratulations page on my external IP. Can You tell how to make that redirection? Regards.

You should go to settings page in web UI and change Default site settings from Congratulations page to 404 page or Custom HTML or configure a redirection.

from nginx-proxy-manager.

PrzemekSkw avatar PrzemekSkw commented on May 17, 2024

Hi, thanks for Your answer. I miss that settings tab. I thougt I have to make someting in command line :D
Thanks.

from nginx-proxy-manager.

anoosa1 avatar anoosa1 commented on May 17, 2024

Any updates? I really need this.

from nginx-proxy-manager.

DeltaLaboratory avatar DeltaLaboratory commented on May 17, 2024

still waiting

from nginx-proxy-manager.

adam-koller avatar adam-koller commented on May 17, 2024

same here, waiting.

from nginx-proxy-manager.

BobWs avatar BobWs commented on May 17, 2024

I've added server_proxy.conf to /data/nginx/error_pages/ (- /data/nginx/error_pages/server_proxy.conf) and the html pages but it isn't working! Do I still need to add the above to the advanced tab?

How do I set this globaly in NPM?

from nginx-proxy-manager.

BobWs avatar BobWs commented on May 17, 2024

Hi everyone, I agree that this should be implemented in the UI but until then, I wanted to explain how I managed to do it so that you can too.

Create a directory named error_pages under your /data/nginx/ directory. Prepare your custom error pages and put them in there. These files will be persistent as I suppose that you mount /data directory to your host machine.

After restarting your container; visit the dashboard, edit a proxy host, go to Advanced tab and paste the following with respect to the name of your error page file:

# Error page for 50x
error_page 500 502 503 504  /error-cloud.html;
proxy_intercept_errors on;
location /error-cloud.html {
internal;
root /data/nginx/error_pages;
}

In this case, my error page filename is error-cloud.html where HTTP code is one of 500, 502, 503 or 504.

You can prepare different error pages for different hosts and also different error pages for different response codes. Hope this is helpful.

How do you prepare different error codes for the same proxy host? e.g. If you want to have an 403 and 502 error page.
And also when I add an image to my custom 502 html error page the image doesn’t show but I use the same html code for the 404 custom page and then the image shows…very weird behavior.

from nginx-proxy-manager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.