Home > PHP Framework > Swoole > body text

How nginx forwards swoole

(*-*)浩
Release: 2019-12-05 13:30:11
Original
3324 people have browsed it

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;端口
 
    }
}
Copy after login

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;
}
Copy after login

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;
}
Copy after login

The above is the detailed content of How nginx forwards swoole. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!