nginx-proxy: How to change HTML error page ?

Hello,

I would like to change HTML error page, and I try to add to my_proxy.conf :

if (-f $document_root/error503.html) {
    return 503;
}

error_page 503 @maintenance;

location @maintenance {
    rewrite ^(.*)$ /error503.html break;
}

Logs :

2016/03/23 18:33:35 [emerg] 17#17: "if" directive is not allowed here in /etc/nginx/conf.d/my_proxy.conf:3

So I remove if :

2016/03/23 18:27:37 [emerg] 17#17: "location" directive is not allowed here in /etc/nginx/conf.d/my_proxy.conf:3

When I launch nginx, I add this line :

 -v /home/reverse_proxy/html:/usr/share/nginx/html 

But it seems to doesn’t work !

Do you know how I can do that ?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 4
  • Comments: 17

Most upvoted comments

@dm17 you might be right that traffic is probably more suitable