nginx swoole yaf

未结帖
0 1553
ajian carter 2017-09-12
悬赏:5飞吻

https://github.com/flyingfishchen/swoole-yaf



swoole-yaf

nginx + swoole + yaf, 使用swoole内置swoole_http_server, 提供REST RPC,参考TSF

说明

nginx用作反向代理,swoole_http_server 相当于PHP-FPM,压测性能比PHP-FPM好,yaf框架以扩展形式提供MVC服务

配置

nginx

server {
        server_name local.swoole.com;
        root /home/wwwroot/default/;
        
        location / {
            if (!-e $request_filename) {
            	proxy_pass http://127.0.0.1:9501;
            	proxy_http_version 1.1;
            	proxy_set_header Connection "keep-alive";
            }
        }
}

运行

Usage:

php start.php start | stop | reload | restart | status | help

cd /home/wwwroot/default/swoole-yaf/server

php start.php start

测试

apt-get install httpie

http http://127.0.0.1:9501/demo

输出

HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 30
Content-Type: application/json;charset=UTF-8
Date: Thu, 25 Feb 2016 02:27:04 GMT
Server: swoole-http-server
X-RateLimit-Limit: 20
X-RateLimit-Remaining: 5

{"first": "one", "second": "two"}


热忱回答0


最近热帖

近期热议

  1. javascript——prototype与__proto 9
  2. Mysql 中出现的Data truncated for column 3
  3. 在nginx中使用x-sendfile的解决方案 3
  4. 高版本jQuery面插件实现Ajax上传图片 1
  5. Thinkphp Socket.class.php 类的使用 1
  6. 使用ionic3创建第一个App 0
  7. ios-oc html5 0
  8. nginx.conf 0
  9. 基于ionic3.4.0的项目搭建 0
  10. php 缩略图 0