51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

nginx+swoole配置

server {
    root /data/wwwroot/;
    server_name local.swoole.com;

    location / {
        proxy_http_version 1.1;
        proxy_set_header Connection "keep-alive";
        proxy_set_header X-Real-IP $remote_addr;
        if (!-e $request_filename) {
             proxy_pass http://127.0.0.1:9501;
        }
    }
}

在swoole中通过读取$request->header['x-real-ip']来获取客户端的真实IP

赞(0)
未经允许不得转载:工具盒子 » nginx+swoole配置