andreybolonin/swoole-http-server-bundle

在 symfony 项目中实现 swoole php 扩展

dev-master 2018-07-13 07:03 UTC

This package is not auto-updated.

Last update: 2024-09-22 13:28:57 UTC


README

在 swoole 中运行 symfony

1 安装

    composer require andreybolonin/swoole-http-server-bundle:dev-master

2 在 services.yaml 中定义命令

    Swoole\HttpServerBundle\Command\RunCommand:
      tags:
          - { name: 'console.command', command: 'swoole:run' }

    Swoole\HttpServerBundle\Command\StatusCommand:
      tags:
          - { name: 'console.command', command: 'swoole:status' }

    Swoole\HttpServerBundle\Command\StopCommand:
      tags:
          - { name: 'console.command', command: 'swoole:stop' }
          
    Swoole\HttpServerBundle\Command\StartCommand:
      tags:
          - { name: 'console.command', command: 'swoole:start' }

2 swoole http 服务器命令

    * bin/console swoole:run   --evn=dev
    * bin/console swoole:start --evn=prod
    * bin/console swoole:status
    * bin/console swoole:stop
    * bin/console swoole:reload

3 nginx 代理配置

    server {
        listen       80;
        server_name  youdomain.com;
        location / {
            proxy_connect_timeout 300;
            proxy_send_timeout 300;
            proxy_read_timeout 300;
            send_timeout 300;
            proxy_set_header X-Real-IP  $remote_addr;
            proxy_set_header Host $host;
            proxy_pass http://127.0.0.1:2345/;
            proxy_redirect off;
        }
    }