全球主机交流论坛
标题:
LNMP wordpress for yum
[打印本页]
作者:
ccnif
时间:
2021-10-8 14:53
标题:
LNMP wordpress for yum
本帖最后由 ccnif 于 2021-10-8 15:06 编辑
看到论坛有同学要 学搭建wordpress写个文章
# 查看wordpress官方环境要求
https://cn.wordpress.org/support/article/requirements/
系统:centos7x
NGINX:主线版本
MySQL:5.6
PHP:7.3
# 第三方源 安装
yum install -y https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-7.rpm
yum install -y epel-release
复制代码
# 关闭selinux
setenforce 0
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
复制代码
# MySQL 安装
yum install -y https://mirrors.tuna.tsinghua.edu.cn/percona/yum/percona-release-latest.noarch.rpm
sed -i 's/repo.percona.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/yum.repos.d/percona-original-release.repo
yum install -y Percona-Server-server-57
systemctl enable --now mysqld
复制代码
# MySQL 设置 root 密码
mysqladmin -uroot -p`cat /var/log/mysqld.log | grep 'temporary password' | awk '{print $NF}'` password "root密码"
复制代码
# MySQL 新建 用户 数据库 设置权限
mysql -uroot -p"P@ssw0rd" -e "CREATE DATABASE IF NOT EXISTS wordpress DEFAULT CHARACTER SET UTF8 COLLATE UTF8_GENERAL_CI;"
mysql -uroot -p"P@ssw0rd" -e "GRANT ALL PRIVILEGES ON wordpress.* TO wordpress@'%' IDENTIFIED BY 'P@ssw0rd';"
mysql -uroot -p"P@ssw0rd" -e "FLUSH PRIVILEGES;"
复制代码
# PHP 安装
yum install -y php74-php-fpm php74-php-mysqlnd
systemctl enable --now php74-php-fpm
复制代码
# PHP-FPM 运行用户设置
sed -i 's/user = apache/user = nginx/g' /etc/opt/remi/php74/php-fpm.d/www.conf
sed -i 's/group = apache/group = nginx/g' /etc/opt/remi/php74/php-fpm.d/www.conf
systemctl restart php74-php-fpm
复制代码
# NGINX 安装
yum -y install nginx
systemctl enable --now nginx
复制代码
# NGINX 配置
https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/
vi /etc/nginx/conf.d/wordpress.conf
upstream php {
server 127.0.0.1:9000;
}
server {
server_name 域名;
root /data0/wordpress;
index index.php;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_pass php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
nginx -t
systemctl reload nginx
复制代码
# 防火墙开启80端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
systemctl start firewalld.service
复制代码
# Wordpress源代码安装
mkdir -p /data0/wordpress
cd /data0/wordpress
wget https://cn.wordpress.org/latest-zh_CN.tar.gz
tar -xf latest-zh_CN.tar.gz
mv wordpress/* ./
rm -rf wordpress latest-zh_CN.tar.gz
cd /data0
chmod 755 wordpress/ -R
chown nginx:nginx wordpress/ -R
复制代码
作者:
zuoridangnian
时间:
2021-10-8 14:58
好麻烦的样子
作者:
cdseoo
时间:
2021-10-8 14:59
docker-compose up -d
作者:
citywar
时间:
2021-10-8 15:00
小白福音 宝塔面板
作者:
钱宗鑫
时间:
2021-10-8 15:08
litespeed更好用,搭建也快速
可以去googl一下相关的一键脚本
作者:
宝丽金
时间:
2021-10-8 15:10
提示:
作者被禁止或删除 内容自动屏蔽
作者:
ixbear
时间:
2021-10-8 15:38
有没有大神提供一下docker-compose.yml文件的
欢迎光临 全球主机交流论坛 (https://loc.wget.at/)
Powered by Discuz! X3.4