美文网首页
Nginx负载 转发到swoole服务器

Nginx负载 转发到swoole服务器

作者: HueyYao | 来源:发表于2021-01-02 16:03 被阅读0次

    Nginx负载 转发到swoole服务器

    nginx服务器conf文件中代码如下:

    通过 if (!-e $request_filename) 判断 注意 if 和 ( 中间要有空格

        server {
            listen       8080;
            server_name  localhost;
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
    
            location / {
                root   /app/thinkphp/public/static;
                index  index.html index.htm;
    
                if (!-e $request_filename){
                    proxy_pass http://127.0.0.1:8812;
                }
            }
    

    如果访问的路由不存在则通过proxy_pass 转发到 http://127.0.0.1:8812;

    http://127.0.0.1:8812是我们通过web_socket服务开启的swoole服务

    相关文章

      网友评论

          本文标题:Nginx负载 转发到swoole服务器

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