配置EPEL源
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
配置Remi源
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm
选择需要安装的版本包
dnf module enable php:remi-8.1
安装PHP 扩展
dnf install php php-cli php-common
查看安装结果
php -v
相关启动php命令
启动php:
systemctl stop php-fpm.service
systemctl restart php-fpm.service
systemctl start php-fpm.service
重启nginx:
nginx -s reload
nginx -c /etc/nginx/nginx.conf
nginx -s stop
ningx配置目录:/etc/nginx/nginx.conf
laravel-supervisord配置
[program:pd-worker]
directory = /var/www/html/pd ; 程序的启动目录
command = sudo -u nginx php artisan queue:work --queue=default,pd_notify_0 --tries=3 --max-time=3600 --daemon ; 启动命令
autostart = true ; 在 supervisord 启动的时候也自动启动
startsecs = 5 ; 启动 5 秒后没有异常退出,就当作已经正常启动了
autorestart = true ; 程序异常退出后自动重启
startretries = 3 ; 启动失败自动重试次数,默认是 3
user = root ; 用哪个用户启动
redirect_stderr = false ; 把 stderr 重定向到 stdout,默认 false
stdout_logfile_maxbytes = 100MB ; stdout 日志文件大小,默认 50MB
stderr_logfile_maxbytes = 100MB ;
stdout_logfile_backups = 180 ; stdout 日志文件备份数;需要注意当指定目录不存在时无法正常启动,
stderr_logfile_backups = 180 ;
stdout_logfile = /var/www/logs/pd/pd-worker.access.log
stderr_logfile = /var/www/logs/pd/pd-worker.error.log
nginx配置
server {
listen 80;
listen 18080;
server_name h5.iu6liu0jahvilum.top gm.iu6liu0jahvilum.top analysis.iu6liu0jahvilum.top merchant.iu6liu0jahvilum.top server.iu6liu0jahvilum.top control.iu6liu0jahvilum.top;
root /var/www/html/pd/public;
location / {
index index.html index.php;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
location ~ \.php(.*)$ {
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param PATH_INFO $1;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $DOCUMENT_ROOT$fastcgi_script_name;
}
error_log /var/www/logs/pd/error.log;
access_log /var/www/logs/pd/access.log;
}