Laravel websockets 导致 python 套接字错误
Laravel websockets causes python socket error
我使用 amazon ec2 在 ubuntu 18.04 中安装了一个项目。我可以从我的项目目录中通过 websockets:serve
命令手动测试 websocket 服务器 运行ning。现在我想要 运行 websockets,docs 说我需要安装 supervisor
,这就是我所做的。我在 /etc/supervisor/conf.d/websockets.conf
中创建了一个配置文件,它具有此配置
[program:websockets]
command=usr/bin/php cd /var/www/html/Inventory/artisan websockets:serve
numprocs=1
autostart=true
autorestart=true
user=laravel-echo
当我做supervisorctl update
时,我得到的是
error: <class 'socket.error'>, [Errno 2] No such file or directory: file: /usr/lib/python2.7/socket.py line: 228
当我也做 sudo supervisorctl status
时,我得到的是
unix:///var/run/supervisor.sock no such file
我的 /etc
目录中没有 supervisor.conf
,supervisor.conf
文件在 /etc/supervisor/supervisor.conf
中,就像其他人遇到的一样。
我需要创建一个 supervisor.sock
文件吗?或者主管会自动创建它?另外,如果我不能解决这个问题,我的第二个选择是通过 cronjob 运行ning websockets。这是正确的做法吗?
无论如何,如果你们对此有任何想法,请提供帮助。谢谢..
我的临时解决方案,我只是用cron 运行 websockets:serve
一年一次
51 16 9 5 * cd /var/www/html/Inventory/ && php artisan websockets:serve >> /dev/null 2>&1 >> /var/www/html/Inventory/websockets.log
只需从命令
中删除"cd"
[program:websockets]
command=/usr/bin/php /var/www/html/Inventory/artisan websockets:serve
numprocs=1
autostart=true
autorestart=true
user=laravel-echo
你可以找到一些参考资料here
[program:laravel-websocket]
command=/path/to/your/php /var/www/vhosts/path/to/yout/artisan websockets:serve
autostart=true
autorestart=true
user=your_user
stderr_logfile=/var/log/supervisor-laravel.websocket.err.log
stdout_logfile=/var/log/supervisor-laravel.websocket.out.log
从不 运行 作为 root
绝对路径,当然还要遵循 supervisord 配置指南
检查错误日志
在配置的端口上执行 netcat/port 扫描以确保您不会错过 proxy/firewall 规则
参考:https://github.com/beyondcode/laravel-websockets/issues/304#issuecomment-590809667
我使用 amazon ec2 在 ubuntu 18.04 中安装了一个项目。我可以从我的项目目录中通过 websockets:serve
命令手动测试 websocket 服务器 运行ning。现在我想要 运行 websockets,docs 说我需要安装 supervisor
,这就是我所做的。我在 /etc/supervisor/conf.d/websockets.conf
中创建了一个配置文件,它具有此配置
[program:websockets]
command=usr/bin/php cd /var/www/html/Inventory/artisan websockets:serve
numprocs=1
autostart=true
autorestart=true
user=laravel-echo
当我做supervisorctl update
时,我得到的是
error: <class 'socket.error'>, [Errno 2] No such file or directory: file: /usr/lib/python2.7/socket.py line: 228
当我也做 sudo supervisorctl status
时,我得到的是
unix:///var/run/supervisor.sock no such file
我的 /etc
目录中没有 supervisor.conf
,supervisor.conf
文件在 /etc/supervisor/supervisor.conf
中,就像其他人遇到的一样。
我需要创建一个 supervisor.sock
文件吗?或者主管会自动创建它?另外,如果我不能解决这个问题,我的第二个选择是通过 cronjob 运行ning websockets。这是正确的做法吗?
无论如何,如果你们对此有任何想法,请提供帮助。谢谢..
我的临时解决方案,我只是用cron 运行 websockets:serve
一年一次
51 16 9 5 * cd /var/www/html/Inventory/ && php artisan websockets:serve >> /dev/null 2>&1 >> /var/www/html/Inventory/websockets.log
只需从命令
中删除"cd"[program:websockets]
command=/usr/bin/php /var/www/html/Inventory/artisan websockets:serve
numprocs=1
autostart=true
autorestart=true
user=laravel-echo
你可以找到一些参考资料here
[program:laravel-websocket]
command=/path/to/your/php /var/www/vhosts/path/to/yout/artisan websockets:serve
autostart=true
autorestart=true
user=your_user
stderr_logfile=/var/log/supervisor-laravel.websocket.err.log
stdout_logfile=/var/log/supervisor-laravel.websocket.out.log
从不 运行 作为 root
绝对路径,当然还要遵循 supervisord 配置指南
检查错误日志
在配置的端口上执行 netcat/port 扫描以确保您不会错过 proxy/firewall 规则
参考:https://github.com/beyondcode/laravel-websockets/issues/304#issuecomment-590809667