rewrite ^/api^/ /$1 break;
— это что-то бессмысленное.error_page 404 = /;
— это никогда не работает (потому что у вас все запросы проксируются) и, скорее всего, не то что имели в виду. В любом случае редиректить 404 это плохая идея.error_page 400 500 404 /;
— тоже не работает. nslookup codeload.github.com
nslookup codeload.github.com 77.88.8.8
localhost:3000
?$ cat /etc/nginx/sites-enabled/chupasaurus
# Это типа «костыль»
server {
listen 127.0.0.1:3001;
location / {
root /var/www/html;
try_files @upstream $uri =404;
}
location @upstream {
proxy_pass http://127.0.0.1:3000;
proxy_intercept_errors on;
recursive_error_pages on;
error_page 404 = @local;
}
location @local {
try_files $uri =404;
}
}
# Это типа сайт
server {
listen 127.0.0.1:3000;
return 200 'OK from 3000\n';
}
$ cat /var/www/html/wtf.html
Hello from wtf.html
$ curl localhost:3000/wtf.html
OK from 3000
$ curl localhost:3001/wtf.html
Hello from wtf.html
$ curl localhost:3001/wtf2.html
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.14.0 (Ubuntu)</center>
</body>
</html>
Похоже на криво закешированный шрифт.