I have a config like this for my Nginx server:
server {
listen 80;
listen 443 ssl;
ssl_certificate /etc/nginx/cert/domain.csr;
ssl_certificate_key /etc/nginx/cert/domain.key;
server_name ~^(\w+)\.(\w+)$ ;
location / {
rewrite ^\/(.*) /$1 break;
proxy_pass https://my-app.ondigitalocean.app/ ;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
error_page 444 =200 @unavailable.html;
location = @unavailable.html {
#root /usr/share/nginx/html;
proxy_pass https://myapp.ondigitalocean.app/unavailable.html;
allow all;
}
if ($allowed_country = no) {
return 444;
}
}
It works fine, but I can't get unavailable.html
page I allocated at the remote server (see proxy_pass
), my error log shows:
[error] 20#20: *1 could not find named location "@unavailable.html", client: 172.17.0.1, server: ~^(\w+)\.(\w+)$
What I'm missing? Is it even possible? Or I have to copy-paste such page to Nginx home?