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服务
网友评论