• centos安装部署wordpress


    Wordpress项目介绍:wordpress 是开源的博客系统
    更多学习课程请访问首页:
    https://edu.51cto.com/lecturer/14390454.html

    1.1 手动部署Wordpress
    #1.安装nginx
    [root@laowang ~]# vim /etc/yum.repos.d/nginx.repo
    [root@laowang ~]# cat /etc/yum.repos.d/nginx.repo
    [nginx-stable]
    name=nginx stable repo
    baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
    gpgcheck=1
    enabled=1
    gpgkey=https://nginx.org/keys/nginx_signing.key
    [root@laowang ~]# yum install nginx -y
    
    #2.配置Wordpress的nginx配置文件
    [root@laowang ~]# cd /etc/nginx/conf.d/
    [root@laowang conf.d]# ls
    default.conf
    [root@laowang conf.d]# rm -f default.conf 
    [root@laowang conf.d]# vim /etc/nginx/conf.d/wordpress.com.conf
    [root@laowang conf.d]# cat /etc/nginx/conf.d/wordpress.com.conf
    server {
            listen       80;
            root   /usr/share/nginx/html;
            server_name  localhost;
        location / {
                index index.php index.html index.htm;
        }
    
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
                root    /usr/share/nginx/html;
        }
        location ~ .php$ {
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
        }
    }
    
    [root@laowang conf.d]# nginx -t
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful
    [root@laowang conf.d]# systemctl start nginx
    [root@laowang conf.d]# systemctl enable nginx
    
    • 安装php
    rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
    rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
    
    #安装PHP
    yum install php70w-common php70w-fpm php70w-opcache php70w-gd php70w-mysqlnd php70w-mbstring php70w-pecl-redis php70w-pecl-memcached php70w-devel -y
    
    • php配置
    #1.修改PHP配置
    [root@laowang ~]# vim /etc/php.ini
    # 修改下面
    session.save_path = “/var/lib/php/session”
    
    #2.更改/var/lib/php/session目录下所有文件的属组都改成 nginx 和 nginx。
    [root@laowang ~]# mkdir -p /var/lib/php/session
    [root@laowang ~]# chown -R nginx:nginx /var/lib/php/session
    
    • 3.下载Wordpress安装包
    [root@laowang ~]# mkdir code
    [root@laowang ~]# cd code/
    [root@laowang code]# wget https://cn.wordpress.org/wordpress-5.2.3-zh_CN.tar.gz
    [root@laowang code]# tar xf wordpress-5.2.3-zh_CN.tar.gz 
    [root@laowang code]# ls
    wordpress  wordpress-5.2.3-zh_CN.tar.gz
    [root@laowang code]# cd wordpress
    [root@laowang wordpress]# ls
    index.php    wp-activate.php     wp-comments-post.php  wp-cron.php        wp-load.php   wp-settings.php   xmlrpc.php
    license.txt  wp-admin            wp-config-sample.php  wp-includes        wp-login.php  wp-signup.php
    readme.html  wp-blog-header.php  wp-content            wp-links-opml.php  wp-mail.php   wp-trackback.php
    
    • 4.安装数据库(这里使用mariadb)
    #1.安装数据库
    [root@laowang ~]# yum -y install mariadb-server mariadb
    [root@laowang ~]# systemctl start mariadb
    [root@laowang ~]# systemctl enable mariadb
    #2.设置root用户名密码为admin123
    [root@laowang ~]# mysqladmin -u root -p password admin123  #因为没有密码,所以直接回车创建
    
    #3.测试登录
    [root@laowang ~]# mysql -uroot -padmin123
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 8
    Server version: 5.5.68-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    #4.创建数据库Wordpress
    MariaDB [(none)]> CREATE DATABASE wordpress;
    
    
    #5.写入数据库信息
    [root@laowang ~]# cd code/wordpress
    [root@laowang wordpress]# cp wp-config-sample.php wp-config.php
    [root@laowang wordpress]# vim wp-config.php 
    /** WordPress数据库的名称 */
    define( 'DB_NAME', 'wordpress' );
    /** MySQL数据库用户名 */
    define( 'DB_USER', 'root' );
    /** MySQL数据库密码 */
    define( 'DB_PASSWORD', 'admin123' );
    /** MySQL主机 */
    define( 'DB_HOST', 'localhost:3306' );
    /** 创建数据表时默认的文字编码 */
    define( 'DB_CHARSET', 'utf8' );
    /** 数据库整理类型。如不确定请勿更改 */
    define( 'DB_COLLATE', '' );
    
    #6.将源代码拷贝到默认目录
    [root@laowang wordpress]# cp -rp ./* /usr/share/nginx/html/
    [root@laowang wordpress]# systemctl start php-fpm
    [root@laowang wordpress]# systemctl enable php-fpm
    [root@laowang wordpress]# nginx -s reload
    
    #7.浏览器访问
    ip
    


    输入账号密码:laowang admin@123456登录


  • 相关阅读:
    [Javascript] Prototype Pattern
    [Typescript] tsexpecterror
    [React] Compound Pattern
    [React] SWR for data fetching
    [Javascript] Factory pattern vs Class instance
    [Typescript] Only Type import or export
    AcWing 1113. 红与黑
    AcWing 178 第K短路
    AcWing 190.字串变换
    AcWing 165 小猫爬山
  • 原文地址:https://www.cnblogs.com/wangyongqiang/p/16055823.html
Copyright © 2020-2023  润新知