使用CentOS8来部署php7.4
#安装REMI源 dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm #查看PHP启用情况并启用相应版本 dnf module list php dnf module enable php:remi-7.4 #安装项目需要用到的 yum install nginx php php-fpm php-mysqlnd php-pecl-redis php-pecl-xxtea #关闭SELinux setenforce 0 vim /etc/sysconfig/selinux
nginx配置文件
server { listen 81 default_server; listen [::]:81 default_server; server_name _; root /var/www/php; index index.php index.html index.htm; location ~ \.(php|phar)(/.*)?$ { fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$; fastcgi_intercept_errors on; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_pass php-fpm; } }