reactjs - ERR_TOO_MANY_REDIRECTS Nginx 尝试使用反应应用程序时?
问题描述
我有一个在端口 3000 上运行的反应应用程序。我可以通过 IP 地址和使用:3000 访问它,但是当我尝试通过 URL 访问该站点时,我收到 ERR_TOO_MANY_REDIRECTS 错误。
我问过卖给我应用程序的人,但他们告诉我问题出在 Cloudflare。问题是,我不使用 cloudflare。我以前曾经使用过,但我的 DNS 直接指向服务器。
我有一个 VPS,我只在上面托管这个网站。
默认设置(我不知道您是否需要帮助)它是我安装 Nginx 时的默认设置。
我当前的“rentfromowner”配置文件如下所示:
# the IP(s) on which your node server is running. I chose port 3000.
upstream rentfromowner {
server 159.65.88.218:3000;
keepalive 8;
}
# the nginx server instance
server {
listen 0.0.0.0:80;
server_name rentfromowner.co.uk www.rentfromowner.co.uk;
return 301 https:/rentfromowner.co.uk$request_uri;
}
server {
listen 0.0.0.0:443 default_server ssl;
server_name rentfromowner.co.uk www.rentfromowner.co.uk;
access_log /var/log/nginx/rentfromowner.log;
ssl on;
ssl_certificate /etc/ssl/certs/ssl-bundle.crt;
ssl_certificate_key /etc/ssl/certs/rentfromowner.co.uk.key;
ssl_prefer_server_ciphers on;
# pass the request to the node.js server with the correct headers
# and much more can be added, see nginx config options
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://www.rentfromowner.co.uk:3000;
proxy_redirect off;
return 301 http://www.rentfromowner.co.uk;
}
}
谁能帮我理解为什么它会重定向并且不起作用,因为这些人告诉我这是正确的-但我认为不可能吗?
因为它没有将端口 80 用于应用程序等 - 那么我以前从未做过这样的事情,所以我试图尽可能多地学习 - 但我根本无法弄清楚。
提前感谢您的帮助。
磷
解决方案
推荐阅读
- c# - C# winform - 根据数据而不是扩展名查找文件类型
- c# - 如何摆脱 Net 5.0 版本中的“%AppName%.runtimeconfig.dev.json”文件
- matplotlib - 3d Matplotlib 矩形框,天气图
- javascript - 简化 JavaScript 中的加法/减法函数
- .net-core - HTTP 错误 500.35 - 在 Azure 应用服务中运行 .NET 5 应用的同一进程中的 ANCM 多个进程内应用程序错误
- c - 打印在 GDB 中用 fopen 打开的文件内容?
- angular - primeng p 表不排序和列选择不切换
- html - DIV 元素在其余 div 元素下方对齐
- c - C语言printf函数及输出问题
- javascript - Iframe 的 SRC 中的 ID 信息