Server environment requirements
- Nignx
- PHP 7.1 ~ 7.3 (Standard Version v4.4 and later versions are compatible with 7.4)
- MySQL 5.7
- Redis
- Supervisor Manager
It is recommended to use bt pagoda panel, which is simple and easy to use.
Alibaba cloud ecs or Tencent cvm cloud servers are recommended.
Add 8 ports: 80,21888884433306637920002 / 20100
Authorization object: 0.0.0.0/0
Delete the following functions
proc_open pcntl_signal pcntl_signal_dispatch pcntl_fork pcntl_wait pcntl_alarm
Execute command
Open message queue:
Supervisor manager, running
php think queue:listen --queue
Open long connection:
sudo -u www php think workerman start --d
Start scheduled task:
php think timer start --d
Customer service configuration (version 4.3.1 and later) Nginx reverse agent
On the web site - Settings - Profiles
Copy the following code, put it before the last brace in the configuration file, and then save it
location /notice { proxy_pass http://127.0.0.1:20002/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; } location /msg { proxy_pass http://127.0.0.1:20003/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; }
Then save the file
The results are as follows:
If you need to modify the port, you need to change the port in the configuration (the default is 20002 20003. See the next step directly)
Port configuration starts from the back-end config / workman PHP, as follows
admin mainly configures the protocol listening address of the background long connection port
chat mainly configures the protocol listening address of the connection port of the front station leader
channel is used to configure internal communication
To change the configuration, mainly change the port field, and then keep consistent with the port linked by the foreground
return [ 'admin' => [ //agreement 'protocol' => 'websocket', //Listening address 'ip' => '0.0.0.0', //Listening port 'port' => 20002, //Sets how many processes are started by the current Worker instance 'serverCount' => 1, ], 'chat' => [ //agreement 'protocol' => 'websocket', //Listening address 'ip' => '0.0.0.0', //Listening port 'port' => 20003, //Sets how many processes are started by the current Worker instance 'serverCount' => 1, ], 'channel' => [ //Internal communication monitoring port 'port' => 20012, //Internal communication address 'ip' => '127.0.0.1', ], ];
Modify customer service port
Only users who modify ports can use 20002 20003 20012 by default
1, First, in the root directory config / workman Modify the corresponding port in the PHP file
v4. After version 3, you can ignore the document
2, Modify the chat service port in h5
The source file is in the uniapp under view in the root directory
Modify config / APP JS, modify port 20003
Modify utils / index JS, modify port 20003
This is the front-end source file. After modification, it needs to be repackaged and uploaded
Front end packaging tutorial: https://help.crmeb.net/crmeb-v4/2307289
3, Modify background order reminder service port
The source file is in admin under view under the root directory
After the change, you should also repackage and upload
Background front-end packaging tutorial: https://help.crmeb.net/crmeb-v4/2307291
Then refresh the cache and restart workman
Background packaging tutorial
On the command line, enter npm install or npm i
Enter npm run build, wait for the package to be completed, copy all the files in the folder, paste and replace the file under / public/admin /
For local debugging, please open the directory in the PHP editor, modify the domain name, and then execute the command
npm run serve