P
P
Pista2021-01-20 20:59:32
PHP
Pista, 2021-01-20 20:59:32

How to set a custom nginx error page for a domain behind Cloudflare?

How to set a custom nginx error page for a domain behind Cloudflare?
I must say right away that I am aware that cloudflare custom error pages can only be created on paid accounts
. In the event of a php crash, I need to give my page with a redirect to the desired url.
For example, the site is running on php, for the experiment, I disabled the php service. The site gives 502 bad gateway, (stub from cloudflare) I need to redirect using nginx for 502 errors, tell me how it's done?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pista, 2021-01-22
@Pista

error_page  500 503  /50x.html;
error_page  502 504  =500  /50x.html;
location = /50x.html {
    root /usr/share/nginx/html;
    internal;
}

A
Andrey Gavrilov, 2021-01-21
@thexaver

https://yandex.ru/search/?text=nginx%20502%20redir...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question