Home >PHP Framework >Swoole >How nginx forwards swoole

nginx serves as a static server and forwards swoole configuration at the same time: (Recommended learning: swoole video tutorial)
location /{
root //静态文件目录;
index index.html index.htm;//默认首页
if(!-e $request_filename){ //判断如果 静态文件不存在就转发给 swoole
proxy_pass https://swooleip:swoole;端口
}
}nginx load balancing: upstream and server are at the same level
upstream name{
server 127.0.0.1:8011;
server 127.0.0.2:8011;
server 127.0.0.3:8011;
}By default, requests will be loaded to each server in order; (round robin)
You can also set the weight of the server The higher the , the greater the chance of being loaded.
For example
upstream name{
server 127.0.0.1:8011 weight=3;
server 127.0.0.2:8011 weight=3;
server 127.0.0.3:8011 weight=1;
}The above is the detailed content of How nginx forwards swoole. For more information, please follow other related articles on the PHP Chinese website!