wordpress 安装备忘

1. 先安装数据库 mariadb

    1.1 指令

          vi /etc/yum.repos.d/mariadb.repo

     1.2 输入以下内容保存   

          [mariadb]

          name = MariaDB

          baseurl = http://yum.mariadb.org/10.3/centos7-amd64

          gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

          gpgcheck=1

     1.3 指令

         yum install MariaDB-server MariaDB-client

      1.4 运行 mariadb

          systemctl  start  mysql

       1.5 配置 mariadb, root 密码等,根据提示操作

          mysql_secure_installation

        1.6 Linux配置mysql表明忽略大小写

           vi  /etc/my.cnf

          修改 (或添加)

          lower_case_table_names=1

          保存后重启mysql,over

          systemctl restart mysql

 

二、下载 WordPress

         1. 创建目录 /opt/www

           mkdir -p /opt/www

          2. 进入该目录

           cd /opt/www

          3. 下载最新WordPress

           wget https://wordpress.org/latest.zip

           4. 解压到当前文件夹 /opt/www

           unzip  latest.zip

           c7f824fec0b8de029063e6ed60038cda3b7.jpg

           

三、配置 WordPress

      1. 进入wordpress 目录

          cd  /opt/www/wordpress

       2. 创建配置文件(通过复制配置文件模板)

          cp   wp-config-sample.php  wp-config.php

       3. 修改数据连接信息

          vi wp-config.php

          a69f6e573b26438471e625f5ab8f3648771.jpg

   

四、安装php 7.2

      1. 安装 php,采用remi的源

       yum -y install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

       yum --enablerepo=remi,remi-php72 install php-fpm php-common

      2. 安装通用模块

       yum --enablerepo=remi,remi-php72 install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml

      3. 启动

        systemctl start php-fpm

五、安装web服务器nginx

      1. 添加 nginx repo

        vi /etc/yum.repos.d/nginx.repo

        添加如下内容

         [nginx]
         name=nginx repo
         baseurl=http://nginx.org/packages/centos/7/$basearch/
         gpgcheck=0
         enabled=1

      2. 安装yum

        yum install nginx

      3. 在 /etc/nginx/conf.d/ 下创建文件 wordpress.conf 输入如下 内容(我这里删除了默认配置文件 default.conf ,也可以直接再default中改)

  server {
    listen 80;
    server_name _;
    index index.php index.html index.htm;
    root   /opt/www/wordpress;
    location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    
    location = /50x.html {
        root /opt/www/wordpress;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

      4. 配置 php 和 nginx (最好是用nginx+apache+php, 懒了, 直接 nginx+fastcgi php-fpm)

          vi /etc/php-fpm.d/www.conf

      修改如下:

         user = nginx
         group = nginx
         listen.owner =  nginx
         listen.group = nginx
         listen = 127.0.0.1:9000 
        listen = /var/run/php-fpm/php-fpm.sock

     5. 配置文件夹权限

        chown -R nginx /opt/www/wordpress

    6. 重启 nginx 和 php-fpm

      systemctl start php-fpm

      systemctl start nginx 

    7. 创建数据库

        登录数据库

         mysql -u root -p      回车

        输入密码后登录,

         create database wordpress    回车,ok

         开启mysql远程访问(看你需要,如果之前没有配置远程访问,还需要修改配置文件,请自己百度)

          GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

          GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.100.%' IDENTIFIED BY 'my-new-password' WITH GRANT OPTION;

六、不出什么问题的话, 访问ip,能够看到如下界面

5ee75c37d46854783929d896c4d8527ef2c.jpg

到此,安装就结束了, 可以开始专心搞wordpress的东东了,

 

转载于:https://my.oschina.net/chen1988/blog/2987347

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值