P
P
pcdesign2017-09-20 15:17:20
Nginx
pcdesign, 2017-09-20 15:17:20

Why am I getting a 404 error when I should be 50x?

Here is the configuration:

server {
        server_name example.com;

        location / {
                try_files $uri @backend;
        }



        location @backend {
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://192.168.1.39:80;
        }



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

When IP 192.168.1.39 is not available, nginx gave a 50x bad gateway error.
But, I've upgraded to nginx/1.12.1 here
, and now if I turn off the server from 192.168.1.39, I get a 404.
Why is that? And how to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Mukovoz, 2017-09-20
@pcdesign

What kind of design is so interesting)) Why not?

location / {
                proxy_pass http://192.168.1.39:80;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

Maybe the problem will be solved?
And also, what is here? http://192.168.1.39:80

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question