CentOS 8 快速安装 lnmp

2020-09-14 20:07  215人阅读  评论 (0)

安装nginx

dnf install nginx

chown -R  nginx:nginx /usr/share/nginx/html

systemctl start nginx
systemctl enable nginx

安装PHP

dnf install php php-mysqlnd php-fpm php-opcache php-gd php-xml php-mbstring php-json

vim /etc/php-fpm.d/www.conf
# 把文件中user=apache, group=apache,修改为user=nginx, group=nginx

systemctl start php-fpm 
systemctl enable php-fpm

安装mysql

dnf install @mysql

systemctl start mysqld
systemctl enable mysqld

mysql_secure_installation

mysql -u root -p
SET GLOBAL validate_password.policy=LOW;
SET GLOBAL validate_password.length=6;
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

安装 swoole

dnf install vim wget make php-devel
wget http://pecl.php.net/get/swoole-4.5.3.tgz
tar xzf swoole-4.5.3.tgz
cd swoole-4.5.3/
./configure
make
make install
echo "extension=swoole" >> /etc/php.ini