Laravel4中设置Server运行模式
修改app\start\artisan.php
Artisan::add(new Qufenqi\Stone\Console\Commands\StoneServer);
定义请求处理类, 我定义在app\Servers\Handler.php
注意 这个其实就是 stone.php 配置里的 server.handler
<?php namespace App\Servers; use Qufenqi\Stone\Contracts\RequestHandler; use Response; class Handler implements RequestHandler { public function process() { return Response::make('hello, stone server!'); } public function onWorkerStart() { } }
运行Stone-Server
sudo php ./artisan stone:server
修改nginx配置
location /server/ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_index index.php; fastcgi_pass unix:/var/run/stone-server-fpm.sock; # Stone include fastcgi_params; }
sudo nginx -s reload
- 完成