美文网首页
swoole学习之nginx笔记

swoole学习之nginx笔记

作者: 以备谈资 | 来源:发表于2018-06-28 15:55 被阅读0次

upstream通讯方式
被定义为访问上游服务器,它把Nginx 定义为反代理服务器,首要功能是透传,其次才是以TCP 获取第三方服务器的内容。简单理解为定义通讯分发方式

upstream分配方式:轮询,指定轮询比例,ip_hash,fair,url_hash

proxy_pass代理转发
1:proxy_pass http://127.0.0.1:9503; // 把请求转发到9503端口的服务器
2:proxy_pass http://http_server; // 把请求转发到upstream定义的http_server通讯方式

nginx location匹配tp5框架路由s=控制器/模块/方法
if ($arg_s != "") {
proxy_pass http://127.0.0.1:9503;
}

if (!-e $request_filename) {
rewrite ^/(.*)$ /?s=/$1 last;
}

参考:
nginx全局变量详解:https://my.oschina.net/sakmon/blog/393919
nginx配置支持websocket:https://wiki.swoole.com/wiki/page/326.html
Nginx之upstream分配方式:https://www.jianshu.com/p/0230dd109ab3

相关文章

网友评论

      本文标题:swoole学习之nginx笔记

      本文链接:https://www.haomeiwen.com/subject/xuogyftx.html