Fetch the repository succeeded.
与其他Web框架不同,SwooleFramework是一个全功能的后端服务器框架。除了Web方面的应用之外,更广泛的后端程序中都可以使用。
PHP版本需求: PHP5.4/PHP5.5/PHP5.6/PHP7.0/PHP7.1,不支持PHP5.3
使用内置应用服务器,可节省每次请求代码来的额外消耗。连接池技术可以很好的帮助存储系统节省连接资源。
在线体验地址:http://www.swoole.com/page/index/
SwooleFramework应用服务器,需要安装swoole扩展。
pecl install swoole
然后修改php.ini加入extension=swoole.so
<?php
require __DIR__.'/libs/lib_config.php';
$AppSvr = new Swoole\Protocol\AppServer();
$AppSvr->loadSetting(__DIR__."/swoole.ini"); //加载配置文件
$AppSvr->setAppPath(__DIR__.'/apps/'); //设置应用所在的目录
$AppSvr->setLogger(new Swoole\Log\EchoLog(false)); //Logger
/**
*如果你没有安装swoole扩展,这里还可选择
* BlockTCP 阻塞的TCP,支持windows平台,需要将worker_num设为1
* SelectTCP 使用select做事件循环,支持windows平台,需要将worker_num设为1
* EventTCP 使用libevent,需要安装libevent扩展
*/
$server = new \Swoole\Network\Server('0.0.0.0', 8888);
$server->setProtocol($AppSvr);
$server->daemonize(); //作为守护进程
$server->run(array('worker_num' => 1, 'max_request' => 5000));
php server.php
[2013-07-09 12:17:05] Swoole. running. on 0.0.0.0:8888
在浏览器中打开 http://127.0.0.1:8888/
server {
listen 80;
server_name www.swoole.com;
root /data/wwwroot/www.swoole.com;
location / {
if (!-e $request_filename){
proxy_pass http://127.0.0.1:9501;
}
}
}
<VirtualHost *:80>
ServerName www.swoole.com
DocumentRoot /data/webroot/www.swoole.com
DirectoryIndex index.html index.php
<Directory "/data/webroot/www.swoole.com">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
# ProxyPass /admin !
# ProxyPass /index.html !
# ProxyPass /static !
# ProxyPass / http://127.0.0.1:9501/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://127.0.0.1:9501$1 [L,P]
</IfModule>
</VirtualHost>
Sign in for post a comment
Activity
Community
Health
Trend
Influence
:Code submit frequency
:React/respond to issue & PR etc.
:Well-balanced team members and collaboration
:Recent popularity of project
:Star counts, download counts etc.
Comments ( 14 )