Centos8安装LNMP
概述
在Centos8完成安装LNMP
步骤
1. 安装MariaDB(略,详见Yum源安装MariaDB)
2. 安装Nginx(略,详见使用nginx官方源安装nginx)
3. 安装PHP
3.1 安装rpm源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-8.rpm
3.2 安装PHP
yum –y install php74-php-common php74-php-fpm php74-php-opcache php74-php-gd php74-php-mysqlnd php74-php-mbstring php74-php-pecl-redis php74-php-pecl-memcached php74-php-devel
3.2 配置PHP-FPM
因php74安装完毕后,没有9000端口,无法使用nginx进行集成,需要更改配置文件,将listen方式更改为tcp socket 方式。
;listen = /var/opt/remi/php74/run/php-fpm/www.sock listen = 127.0.0.1:9000
4. 配置Nginx
location ~ \.php(.*)$ { root /usr/share/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
知识点
nginx与php-fpm通信的两种方式: tcp socket 和 unix socket。
借鉴资料
版权声明:
作者:龙魂
链接:https://blog.wlzs.cn/centos8%e5%ae%89%e8%a3%85lnmp/
文章版权归作者所有,未经允许请勿转载。
THE END