如何在生产环境中运行Laravel Websockets(ubuntu + apache2)?

3

这是一个关于产品支持的问题,最好适合在 Laravel Websockets 论坛上提问吗? - Jeter-work
2个回答

2
在运行您的WebSocket服务器后,您需要将其代理到Apache。如下所示进行配置:
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName your.domain.com
ProxyPass / http://localhost:6001/
ProxyPassReverse / http://localhost:6001/
</VirtualHost>

将6001更改为您的websocket端口。

如果要在后台运行,您需要使用nohup或pm2将websocket服务器添加到后台。例如:

pm2 start "php artisan websockets:server"

或者使用nohup

nohup php artisan websockets:server

我的建议是使用supervisord,这样您就可以设置php artisan websockwt:serve。 - San K
我在生产环境中是否仍需运行 php artisan websockets:serve 命令?或者只需要配置 Apache 就可以了吗? - Fantasmic
@Fantasmic 你需要使用 supervisord、pm2 或 nohup 来运行它。 - Muhammad Dyas Yaskur
有人能帮忙教如何在 Nginx 服务器上运行吗? - Michel Rivera
那么在 SSL 中运行它怎么样? - iPhoneJavaDev

0
你可以使用supervisord,你可以安装并配置文件来运行命令php artisan web socket:serve。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接