reactjs - Nginx 负载均衡器不加载 React 站点
问题描述
我有以下网站,它是一个 React 构建的网站。我有一个带有两个后端服务器的 nginx 负载平衡站点。各个服务器运行良好,但是当在负载平衡器后面时,站点很少加载并且查看浏览器开发工具时会出现大量 404 Not Found 错误:
https://junoscan.skynetexplorers.com
我不明白为什么网站不加载。有时浏览器会开始正常工作。例如,目前 Brave Browser 无法在我的桌面上运行,但开始在我的手机上运行。怎么了?如何解决此行为?
##
# Set Rate Limiting (DDoS protection)
##
limit_req_zone $binary_remote_addr zone=req_zone:10m rate=5r/s;
# This is the internal server behind the proxy
upstream bdipper_node {
least_conn;
server cluster.provider-0.prod.sjc1.akash.pub:31375;
server cluster.provider-2.prod.ewr1.akash.pub:31639;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# This is the public facing listening server AND configures SSL for the website
server {
root /_next/static/chunks;
sendfile on;
tcp_nopush on;
sendfile_max_chunk 1m;
tcp_nodelay on;
keepalive_timeout 65;
listen 443 ssl;
location / {
limit_req zone=req_zone burst=20 nodelay;
proxy_pass http://bdipper_node/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host:443;
}
}
# This redirect http to https
server {
listen 80 ;
return 301 https://$host$request_uri;
}
解决方案
推荐阅读
- perl - 获取 Par::Packer 的所有依赖项?
- java - 创建一个新的数组对象会导致出现几个错误
- progressive-web-apps - 如何在渐进式网络应用程序中进行定期后台同步?
- docker - 使用应用程序负载均衡器连接到 Rancher 上的 Docker 容器的纯 IPv6 客户端?
- arm - stm32f103:强制 DMA 传输完成中断
- events - DDD 使用 NoSQL 在有界上下文中处理多个聚合的最终一致性
- java - cassandra 在字段中存储“z”(在我的情况下这是错误的日期格式)
- android-studio - 在 android studio 中编译我的应用程序时出现异常
- javascript - 如何打印从a到b的每个坐标(坐标)
- saml - 对于 SaaS 提供商,SP 到 Okta 的分支是否符合 SAML 标准?