centos9安装php8及以上,nginx配置

配置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     _;
       server_name h5.iu6liu0jahvilum.top gm.iu6liu0jahvilum.top analysis.iu6liu0jahvilum.top merchant.iu6liu0jahvilum.top server.iu6liu0jahvilum.top control.iu6liu0jahvilum.top;
       #root            /var/www/html;
       root            /var/www/html/pd/public;
       location / {
	       index index.html index.php;
	       # 去掉index.php
	       if (!-e $request_filename) {
	               rewrite ^(.*)$ /index.php?s=/$1 last;
	               break;
	       }
       }

        location ~ \.php(.*)$ {             # 正则匹配.php后的pathinfo部分
            fastcgi_pass    unix:/run/php-fpm/www.sock;
            fastcgi_index   index.php;
#            fastcgi_param   SCRIPT_FILENAME  $DOCUMENT_ROOT$fastcgi_script_name;
            fastcgi_param   PATH_INFO $1;         # 把pathinfo部分赋给PATH_INFO变量
            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;
}
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值