首页天道酬勤nginx百万转发需要什么配置,路由传参的两种方式

nginx百万转发需要什么配置,路由传参的两种方式

admin 05-12 17:09 140次浏览

nginx最简单的配置,传输所有需求

阿里巴巴云(AlibabaCloud ) ec2开始了python Fastapi撰写的服务。 当前,要访问所有api,需要Alibaba云(AlibabaCloud )的公共ip。 服务器正在使用5001端口。

问题

最初,可以通过公共ip访问的是/

其他路径均为404条

在nginx位置上执行proxy _ pass http://127.0.0.1:5001 $ request _ uri;

解决方法

在nginx位置中使用proxy _ pass http://127.0.0.1:5001; http://127.0.0.1:5001 $ request _ uri;

nginx配置文件显示以下upstream flask { server 127.0.0.133605001; }server {listen 80 default_server; listen [ :3360 ] :80 default _ server; 根/var/www/html; # addindex.phptothelistifyouareusingphpindex.htmlindex.htm index.nginx-debian.html; 服务器_ name _; 位置/{ # firstattempttoserverequestasfile,then# as directory,thenfallbacktodisplayinga 404.proxy _ pass 3358127.PPS proxy_set_header Host $host; #设置将原始请求ip传递给gunicorn服务器proxy _ set _ headerx-real-IP $ remote _ addr的请求头; try_files $uri $uri/=404; }

Paste Image插件
nginx 80端口转发失效,nginx转发后请求返回不了 nginx反向代理有时候跨域,域名url转发
相关内容