How to run Laravel Websockets in production (ubuntu + apache2)?

Viewed 2724
2 Answers

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

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

Related