CentOS上安装WordPress

在CentOS上安装WordPress是一个相对直接的过程,可以通过多种方法完成,包括使用LAMP(Linux, Apache, MySQL, PHP)栈或使用更现代的LEMP(Linux, Nginx, MySQL, PHP)栈。

我选择的是(Linux, Nginx, MySQL, PHP)

基础安装教程

虚拟机安装linux,我这里忽略,有很多虚拟机安装centos的教程。

安装Nginx的链接 https://blog.csdn.net/xiaoyaozizai1/article/details/105552639

安装 MySQL https://blog.csdn.net/xiaoyaozizai1/article/details/145666645

安装 PHP https://blog.csdn.net/xiaoyaozizai1/article/details/145648982

以上是准备工作

下载wordpress源码包

cd /www/html

wget https://cn.wordpress.org/latest-zh_CN.zip

解压,如果没有unzip需要使用yum安装!

unzip latest-zh_CN.zip

配置nginx

cd /data/nginx-1.24.0/conf

vi nginx.conf

配置文件如下:

server {

listen 88 default_server;

listen :::88 default_server;

这里改动了,也可以写你的域名

server_name localhost;

默认网站根目录(www目录)

root /www/html/wordpress;

index index.php;

Load configuration files for the default server block.

include /data/nginx-1.24.0/conf*.conf;

location / {

这里改动了 定义首页索引文件的名称

index index.php index.html index.htm;

}

error_page 404 /404.html;

location = /40x.html {

}

error_page 500 502 503 504 /50x.html;

location = /50x.html {

}

这里新加的

PHP 脚本请求全部转发到 FastCGI处理. 使用FastCGI协议默认配置.

Fastcgi服务器和程序(PHP,Python)沟通的协议.

location ~ \.php$ {

root /www/html/wordpress;

设置监听端口

fastcgi_pass unix:/data/php-8.0.24/php-cgi.sock;

设置nginx的默认首页文件(上面已经设置过了,可以删除)

fastcgi_index index.php;

设置脚本文件请求的路径

fastcgi_param SCRIPT_FILENAME /www/html/wordpress$fastcgi_script_name;

引入fastcgi的配置文件

include fastcgi_params;

}

}

保存 nginx.conf

重新启动nginx

sudo systemctl restart nginx

浏览器输入192.168.0.111:88 验证

这个是nginx指向wordpress文件成功

在网页安装wordpress

点击现在就开始

在浏览器输入原来的地址,可以看到自己的一个网站

http://192.168.0.111:88/

相关推荐
Decay__5 小时前
PostgreSQL 数据库全栈运维实战系列 — 合集索引(24 篇)
运维·数据库·sql·mysql·架构
戊本菌5 小时前
进程(三)runqueue 与 Linux 的 O(1) 调度
linux·运维·服务器
光电笑映7 小时前
TCP 为什么可靠?从三次握手、滑动窗口到拥塞控制全面拆解(下)
linux·网络·网络协议·tcp
yz_aiks8 小时前
Termux 使用教程:把安卓手机变成随身 Linux(装 Python、SSH 远程、跑自动化脚本)
android·linux·python·智能手机·ssh·termux
csdn_aspnet11 小时前
在 Docker 容器中本地运行 SQL Server
运维·docker·容器·sqlserver
hi_ro_a12 小时前
Ext系列⽂件系统详解
linux·服务器·操作系统
Z21-X13 小时前
云原生运维学习笔记:Kubernetes Volume 与 Secret 实验
运维·笔记·学习·云原生·kubernetes
你住过的屋檐14 小时前
【SeaweedFS】Linux上搭建SeaweedFS文件存储服务完整教程
linux·运维·服务器
Decay__15 小时前
PostgreSQL 体系架构全解 —— 进程模型、共享内存、MVCC 与 WAL 预写日志深入
运维·数据库·sql·mysql·架构
少司府15 小时前
嵌入式外设篇(三)GPIO·三:MCU系统结构、总线与统一编制
linux·python·stm32·单片机·嵌入式硬件·mcu·嵌入式软件