LNMP环境搭建wordpress

LNMP环境搭建wordpress

安装mysql

# cd /tmp/
# wget -i https://dev.mysql.com/mysql57-community-release-el7-10.noarch.rpm
# yum -y install mysql57-community-release-el7-10.noarch.rpm
# cd /etc/yum.repos.d/
# ls
# yum -y install mysql-community-server

# systemctl restart mysqld
# grep "password" /etc/log/mysqld.log
xxxxxx
# mysql -uroot -p"xxxxxx"
> alter user root@"localhost" identified by "@AB12ab"
> create database wordpress;
> create user 'wordpress'@'localhost' identified by '@ABab12';
> grant all privileges on wordpress.* to 'wordpress'@'localhost';
> flush privileges;

安装Nginx

# yum install -y nginx
# vim /etc/nginx/conf.d/wordpress.conf
server {
listen 80;
server_name www.test.com;

root /wordpress;
location / {
index index.html inex.htm index.php;
try_files $uri $uri/ /index.php index.php;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

# cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
# vim /etc/nginx/nginx.conf
删除server{}字段删除,38行开始
# systemctl restart nginx

安装PHP环境

# yum -y install php-fpm php-mysql
# sytemctl restart php-fpm
# vim /etc/php-fpm.d/www.conf
user = nginx
group = nginx
# sytemctl restart php-fpm
# lsof -i:9000

安装wordpress

下载解压

# cd /tmp
# wget https://wordpress.org/latest.tar.gz
# tar xvf latest.tar.gz
# mv wordpress /
# chmod 777 /wordpress

# systemctl restart nginx
# systemctl restart mysqld
# systemctl restart php-fpm
# systemctl stop firewalld
# setenforce 0

设置wp-config.php文件,根据自己的数据库修改相关配置

或直接在浏览器界面修改


# cp /wordpress/wp-config-sample.php /wordpress/wp-config.php
# vim /wordpress/wp-config.php

 

 

 

posted @ 2021-03-09 00:11  破碎的屋檐  阅读(64)  评论(0编辑  收藏  举报