一、基本环境配置
修改root密码:sudo passwd root
2.使用root账号登录:ssh root@IPADDRESS
3.安装epel源:dnf install epel-release
4.安装dnf-utils:dnf install dnf-utils
5.安装php7.4的源:dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm
6.系统更新:dnf upgrade&&dnf update
7.重启:reboot
修改用户名:usermod -l xiaoyu ecs-user
2.修改家目录:usermod -d /home/xiaoyu -m xiaoyu
3.修改组名:groupmod -n xiaoyu ecs-user
4.权限继承:vim /etc/sudoers.d/90-cloud-init-users
5.查看:id xiaoyu
修改ssh登录欢迎信息:vim /etc/motd
二、搭建LNMP环境
安装nginx:dnf install nginx gcc pcre pcre-devel zlib zlib-devel
2.安装php 7.4:dnf module install php:remi-7.4
3.安装php 7.4:yum install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json php-redis
3.安装mariadb:dnf install mariadb mariadb-server
三、修改配置文件
修改nginx配置文件:vim /etc/nginx/nginx.conf
# For more information on configuration, see:# * Official English Documentation: http://nginx.org/en/docs/# * Official Russian Documentation: http://nginx.org/ru/docs/user nginx;worker_processes auto;error_log /var/log/nginx/error.log;pid /run/nginx.pid;# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.include /usr/share/nginx/modules// ** Database settings - You can get this info from your web host ** //define('WP_CACHE', true);define( 'WPCACHEHOME', '/usr/share/nginx/html/wp-content/plugins/wp-super-cache/' );define( 'DB_NAME', 'wordpress' );define( 'DB_USER', 'wpadmin' );define( 'DB_PASSWORD', 'wppasswd' );define( 'DB_HOST', 'localhost' );define( 'DB_CHARSET', 'utf8' );define( 'DB_COLLATE', '' );define( 'AUTH_KEY', 'put your unique phrase here' );define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );define( 'LOGGED_IN_KEY', 'put your unique phrase here' );define( 'NONCE_KEY', 'put your unique phrase here' );define( 'AUTH_SALT', 'put your unique phrase here' );define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );define( 'LOGGED_IN_SALT', 'put your unique phrase here' );define( 'NONCE_SALT', 'put your unique phrase here' );$table_prefix = 'wp_';define( 'WP_DEBUG', false );if ( ! defined( 'ABSPATH' ) ) {define( 'ABSPATH', __DIR__ . '/' );}require_once ABSPATH . 'wp-settings.php';
来源地址:https://blog.csdn.net/xinxiaoyu_/article/details/126498951