kerisy / framework

此包最新版本(dev-master)没有可用的许可证信息。

基于swoole的Web框架

dev-master 2017-03-26 14:16 UTC

This package is not auto-updated.

Last update: 2024-09-14 17:59:00 UTC


README

##### Kerisy 使用 swoole HTTP 服务器。

Web 服务器运行命令:php kerisy server start

RPC 服务器运行命令:php kerisy rpcserver start

作业服务器运行命令:php kerisy jobserver start(首先导入 jobs.sql)

##### 使用 nginx HTTP 服务器

  • 添加 "index.php",写入以下代码
<?php

require __DIR__ . '/vendor/autoload.php';

ini_set('display_errors', 1);

defined('APPLICATION_PATH') || define('APPLICATION_PATH', __DIR__ . '/application/');
defined('CONFIG_PATH') || define('CONFIG_PATH', APPLICATION_PATH . '/config/');

defined('KERISY_ENV') || define('KERISY_ENV', getenv('KERISY_ENV')?:'development');

defined('CLI_MODE') || define('CLI_MODE', PHP_SAPI === 'cli' );

$app = new \Kerisy\Core\Application\Web();
$app->webHandle();

  • nginx 配置

server {
        listen          80;
        server_name     rpc.test;
        root            /mnt/hgfs/code/kerisy_rpc;
        access_log      /var/log/nginx/kerisy_rpc.access.log;
        error_log       /var/log/nginx/kerisy_rpc.error.log;
        index  index.php index.html;

        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php$1 last;
        }

        location ~ ^(.+?\.php)(/.*)?$ {
                try_files $1 = 404;

                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                include fastcgi_params;

                fastcgi_param SCRIPT_FILENAME $document_root$1;
                fastcgi_param PATH_INFO $2;
                fastcgi_param HTTPS on;
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        }

        location ~ ^/(images|video|static)/ {
                root /mnt/hgfs/code/kerisy_rpc;
                #expires 30d;
        }
}