Giter Site home page Giter Site logo

swoole-yaf's Introduction

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"}

swoole-yaf's People

Contributors

flyingfishchen avatar

Watchers

Joe Stone avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.