I downloaded Laravel with Reverb on my local server and everything is working perfectly.
but laravel reverb dont work without php artisan reverb:start
in production envirement .. should i run php artisan reverb:start
to make it work ?
this is my nginx setup
server {
server_name domain.com;
root /path/to/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_hide_header X-Powered-By;
}
location ~ /\.(?!well-known).* {
deny all;
}
location /app {
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header Scheme $scheme;
proxy_set_header SERVER_PORT $server_port;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://0.0.0.0:8080;
}
{{certbot cert}}
}
{{certbot cert}}
If the server is running Linux, the solution is to create a supervisor.
Create supervisor
sudo nano /etc/supervisor/conf.d/laravel-reverb.conf
Put this code :
[program:laravel-reverb]
process_name=%(program_name)s_%(process_num)02d
command=php /path-to-your-laravel-app/artisan reverb:start
autostart=true
autorestart=true
user=your-user
numprocs=1
redirect_stderr=true
stdout_logfile=/var/log/laravel-reverb.log
Run this commands:
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-reverb:*
Note :
You can name the file laravel-reverb
whatever you want.