3

I'm using the Laravel Websockets package https://beyondco.de/docs/laravel-websockets/getting-started/introduction.

In my local dev server I run it using php artisan websockets:server and it works fine, but I would like to know how can I run it in my production server (Ubuntu + Apache2).

Fantasmic
  • 1,122
  • 17
  • 25

2 Answers2

2

After run your websocket server, you need proxypass to your apache. like below config:

<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName your.domain.com
ProxyPass / http://localhost:6001/
ProxyPassReverse / http://localhost:6001/
</VirtualHost>

change 6001 to your websocket port.

To run in background you need to add your websocket server in backround using nohup or pm2 . example:

pm2 start "php artisan websockets:server"

or using nohup

nohup php artisan websockets:server
Muhammad Dyas Yaskur
  • 6,914
  • 10
  • 48
  • 73
0

You can use supervisord , you can install and have configuration file to run command php artisan web socket:serve

San K
  • 223
  • 1
  • 5