欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 健康 > 美食 > CentOS上安装WordPress

CentOS上安装WordPress

2025/2/23 1:27:44 来源:https://blog.csdn.net/xiaoyaozizai1/article/details/145648829  浏览:    关键词: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/  

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词