centos7.9离线部署LNMP
首先要完成MySQL,php,nginx的安装
Centos7.9 mysql5.7离线部署
Centos7.9 php离线部署
Centos7.9 nginx离线部署
下载wordpress到本地,使用sftp工具上传至服务器
wordpress.zip下载
安装zip解压工具: yum install unzip -y
unzip wordpress-6.5.2-zh_CN.zip //解压
mv wordpress/* /usr/local/nginx1.25/html/ //移动wordpress目录所有文件至nginx的html目录
mysql创建一个新用户个wordpress使用
mysql -u root -p //登录MySQL
mysql> create user 'word'@'localhost' identified by 'Qwert1234'; //创建word用户,密码为Qwert1234
mysql> create database word; //创建word数据库
mysql> grant all privileges on word.* to 'word'@'localhost' identified by 'Qwert1234'; //授权word用户使用word数据库
mysql> flush privileges; //刷新权限
mysql> quit; //退出
编辑nginx配置文件
vi /usr/local/nginx1.25/conf/nginx.cnf
#vi /usr/local/nginx1.25/conf/nginx.cnf
server {
listen 80 default_server;
server_name localhost;
location / {
root html;
index index.php index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#
进入/usr/local/nginx1.25/html目录配置wordpress与MySQL链接文件
cp wp-config-sample.php wp-config.php
vi wp-config.php
#vi wp-config.php
/** WordPress 数据库名称 */
define( 'DB_NAME', 'word' );
/** 数据库用户名 */
define( 'DB_USER', 'word' );
/** 数据库密码 */
define( 'DB_PASSWORD', 'Qwert1234' );
/** 数据库主机 */
define( 'DB_HOST', 'localhost' );
#
访问nginx服务