To set up Laravel Reverb on production with a self-signed or existing certificate on Laravel Forge, you need to ensure that your Reverb server is correctly configured to use the SSL certificate. Here are the steps to achieve this:
-
Ensure the Certificate is Correctly Installed: Make sure that your SSL certificate is correctly installed on your server. You can verify this by checking if your main site (e.g.,
subdomain.domain.com) is accessible via HTTPS. -
Update the
.envFile: Your.envfile should have the correct settings for Reverb. Based on your description, it looks like you have already set it up correctly. Just to reiterate, it should look like this:REVERB_HOST=ws.subdomain.domain.com REVERB_PORT=443 REVERB_SERVER_HOST=0.0.0.0 REVERB_SERVER_PORT=8080 REVERB_SCHEME="https" -
Configure the Reverb Daemon: You need to create a daemon to run the Reverb server. In Laravel Forge, you can set up a daemon with the following command:
php artisan reverb:serve --host=0.0.0.0 --port=8080 --scheme=https -
Edit the
reverb.confFile: Thereverb.conffile should be configured to listen on the correct port and use the SSL certificate. Here is an example configuration:server { listen 443 ssl; server_name ws.subdomain.domain.com; ssl_certificate /etc/nginx/ssl/your_certificate.crt; ssl_certificate_key /etc/nginx/ssl/your_certificate.key; location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }Make sure to replace
/etc/nginx/ssl/your_certificate.crtand/etc/nginx/ssl/your_certificate.keywith the actual paths to your SSL certificate and key files. -
Restart Nginx: After updating the
reverb.conffile, you need to restart Nginx to apply the changes. You can do this by running:sudo service nginx restart -
Verify the Setup: Finally, verify that your Reverb server is running correctly and accessible via the specified subdomain and port. You can do this by navigating to
https://ws.subdomain.domain.comin your browser or using a tool likecurlto check the response.
By following these steps, you should be able to get your Reverb server running with your existing SSL certificate on Laravel Forge. If you encounter any issues, make sure to check the Nginx error logs for more details on what might be going wrong.