webman:配置端口/日志等(v1.5.7)

发布时间 2023-08-23 09:58:08作者: 刘宏缔的架构森林

一,文档地址:

https://www.workerman.net/doc/webman/others/security.html
https://www.workerman.net/doc/webman/request.html
https://www.workerman.net/doc/webman/config.html

说明:刘宏缔的架构森林—专注it技术的博客,
网站:https://blog.imgtouch.com
原文: https://blog.imgtouch.com/index.php/2023/08/20/webman-pei-zhi-duan-kou-ri-zhi-deng-v1-5-7/
代码: https://github.com/liuhongdi/ 或 https://gitee.com/liuhongdi
说明:作者:刘宏缔 邮箱: 371125307@qq.com

二,配置文件:

config/server.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/**
 * This file is part of webman.
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the MIT-LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @author    walkor<walkor@workerman.net>
 * @copyright walkor<walkor@workerman.net>
 * @link      http://www.workerman.net/
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
 */
 
return [
    'listen' => 'http://0.0.0.0:8787',
    'transport' => 'tcp',
    'context' => [],
    'name' => 'webman',
    'count' => cpu_count() * 4,
    'user' => '',
    'group' => '',
    'reusePort' => false,
    'event_loop' => '',
    'stop_timeout' => 2,
    'pid_file' => runtime_path() . '/webman.pid',
    'status_file' => runtime_path() . '/webman.status',
    'stdout_file' => runtime_path() . '/logs/stdout.log',
    'log_file' => runtime_path() . '/logs/workerman.log',
    'max_package_size' => 10 * 1024 * 1024
];

说明一:各设置项的意义

listen: 配置ip地址和端口

count: 进程数量,默认是cpu数量x4

user/group: 新生成进程的用户和组

pid_file: 保存pid的文件

stdout_file: stdout保存在这个文件中,相当于调试开发时控制台上的输出内容

log_file: 启动停止等系统级的日志

max_package_size: 上传文件大小受到的限制,默认10M

说明二:

服务器配置config/server.php以及进程配置config/process.php不支持reload,需要restart重启才能生效

三,查看webman的版本:

liuhongdi@lhdpc:/data/webman/imageadmin$ composer show workerman/webman-framework
name     : workerman/webman-framework
descrip. : High performance HTTP Service Framework.
keywords : High Performance, http service
versions : * v1.5.7
...