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/

相关推荐
orion5718 小时前
Missing Semester Class1:course overview and introduction of shell
linux
SkyWalking中文站1 天前
认识 Horizon UI · 6/17:Trace 探索器
运维·监控·自动化运维
用户120487221611 天前
Linux驱动编译与加载
linux·嵌入式
火车叼位1 天前
写给初级开发者:SSL、SSH、HTTPS 与证书体系全解析
运维
用户805533698031 天前
Input 子系统架构:Core、Handler、Driver 三层是怎么协作的
linux·嵌入式
用户805533698031 天前
RK-Forge外设系列开篇 - 把板子从「能启动」变成「能用」:Ethernet/SPI/MMC 三个纯接线外设
linux·github·嵌入式
小猿姐2 天前
唯品会大规模数据库云原生实践:基于 KubeBlocks 管理数千实例的统一运维之路
运维·elasticsearch·云原生
七歌杜金房2 天前
我终于又有了自己的 Linux 电脑
linux·debian·mac
SkyWalking中文站2 天前
认识 Horizon UI · 5/17:3D 基础设施地图
运维·监控·自动化运维
tntxia3 天前
linux curl命令详解_curl详解
linux