搭建 lnmp 。。。
# 命名服务器
hostnamectl set-hostname atong
# 更新yum
yum update -y && reboot
# 安装nginx
yum -y install nginx
# 查看nginx版本
nginx -v
# 更新mysql - YUM源。
rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
# 安装mysql
yum -y install mysql-community-server
# 安装 EPEL 源
yum install epel-release
# 安装 REMI 源(该源php版本最新)
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
# 安装 php
yum --enablerepo=remi-php73 install php
# 安装php常用扩展
yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt php-devel php-mysql php-gd php-bcmath php-pdo php-pecl-imagick php-fpm
# 启动php服务
systemctl restart php-fpm
# 查看php扩展
php -m
# 编辑mysql配置文件
vim /etc/my.cnf
# 最后一行添加代码(关闭密码强度校验):
plugin-load=validate_password.so
validate-password=OFF
# 重启mysql
systemctl restart mysqld
# 获取mysql初始密码
grep 'temporary password' /var/log/mysqld.log
# 初始化配置mysql
mysql_secure_installation
# 进入mysql
mysql -u root -p
# 重置密码
> SET PASSWORD = PASSWORD('root');
# 更改 navicat 可访问
> use mysql;
> update user set host = "%" where user = "root";
> flush privileges;
> quit;# 修改nginx配置
vim /etc/nginx/nginx.conf
>>>
location / {
index index.php index.html index.htm;
}
#配置Nginx通过fastcgi方式处理您的PHP请求
location ~ .php$ {
root /usr/share/php;
fastcgi_pass 127.0.0.1:9000; #Nginx通过本机的9000端口将PHP请求转发给PHP-FPM进行处理。
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; #Nginx调用fastcgi接口处理PHP请求
}
<<<
# nginx 多站点配置
vim /etc/nginx/conf.d/demo.conf
>>>
server {
listen 80;
listen [::]:80;
server_name demo.kder.top;
root /usr/share/php;
location / {
index index.php admin.php index.html index.htm;
}location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# 要开启 phpinfo 模式
# 即去掉 php.ini 中 ;cgi.fix_pathinfo=1 的注释
fastcgi_param PATH_INFO $1;
include fastcgi_params;
}}
<<<
# 重启nginx
systemctl restart nginx# 设置为开机启动
systemctl enable mysqld
systemctl enable php-fpm
systemctl enable nginx
安装 swoole 扩展(新增扩展的示例)
systemctl restart php-fpm
yum --enablerepo=remi-php73 install php-swoole -y
待续。。