centos7 安装 wrodpress 4.9

本文提供了一套详细的步骤来帮助读者在本地环境中安装并配置WordPress博客系统。涵盖了安装nginx、mysql及php的基本过程,并提供了如何设置WordPress数据库连接的具体指令。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

提前条件:

安装nginx 1.12

安装mysql 5.7.22

安装php 7.2

安装nginx,mysql,php指导:

https://blog.youkuaiyun.com/jameshadoop/article/details/81209331

https://blog.youkuaiyun.com/jameshadoop/article/details/78817911

https://blog.youkuaiyun.com/jameshadoop/article/details/81230158

 

下载、解压、填写数据库连接串:

mkdir /data/webs
cd /data/webs
wget https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gz
tar -zxvf wordpress-4.9.4-zh_CN.tar.gz
cp wordpress/wp-config-sample.php wordpress/wp-config.php
vi wordpress/wp-config.php
/** WordPress数据库的名称 */
define('DB_NAME', 'wp_test');
/** MySQL数据库用户名 */
define('DB_USER', 'wp_user');
/** MySQL数据库密码 */
define('DB_PASSWORD', 'pw1!23456');
/** MySQL主机 */
define('DB_HOST', 'localhost:3306');
/** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8mb4');

vi /etc/nginx/conf.d/wp_test.conf

server {
    listen       80;                        # 监听端口
    server_name www.siteA.com siteA.com;    # 站点域名
    root  /data/webs/wordpress;              # 站点根目录
    index index.html index.htm index.php;   # 默认导航页

    location / {
        # WordPress固定链接URL重写
        if (!-e $request_filename) {
            rewrite (.*) /index.php;
        }
    }

    # PHP配置
    location ~ \.php$ {
        root  /data/webs/wordpress;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;        
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

启动php:

systemctl start php-fpm

重启nginx:

systemctl stop nginx

systemctl start nginx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值