搭建WordPress个人网站

准备域名

搭建网站的第一步肯定拥有一个自己的域名(当然愿意用IP地址直接访问也没什么问题),域名购买途径很多,阿里云腾讯云百度云等服务器供应商都能购买域名,一般建议域名和服务器都在同一个平台购买,会很方便。

域名购买成功后紧随的就是域名的实名认证和域名备案,都可以在购买域名的供应商处完成,域名备案时间7到15个工作日不等,快的甚至3个工作日就能完成
在这里插入图片描述

准备服务器

想要运行Wordpress网站程序,必须要有对应的软件,也就是服务器环境,比如我们常说的LNMP就是 Linux + Nginx + Mysql + PHP 环境,最常见的网站程序,Wordpress程序就是结合这些语言开发出来的。

其实环境里面安装LNMP是众所周知的,这里我要说的是软件的版本,服务器不同于虚拟主机,我们可以自主控制各种程序的参数和版本,这将让网站的配置非常灵活。为了wordpress兼容和性能,关于软件版本的选择有一个很好的标准就是wordpress官方推荐环境,官方的建议是PHP7.2版本及以上,Mysql5.6版本及以上,还有就是https,安装软件的的原则就是版本越接近推荐的越好

接下来就让我们从使用服务器命令开始,搭建Wordpress网站的LNMP环境

mysql资源库地址

官网下载MySQL包

nginx官方下载

php官方下载

wordpress中文官方下载

lnmp软件包地址

安装lnmp
安装mysql
[root@VM-0-17-centos ~]# mkdir -p  /wordpress/mysql
[root@VM-0-17-centos ~]# rpm -q wget || yum -y install wget && wget -P /opt https://repo.mysql.com/yum/mysql-8.0-community/el/7/aarch64/mysql80-community-release-el7-3.noarch.rpm
[root@VM-0-17-centos ~]# cd /opt/
[root@VM-0-17-centos opt]# yum -y install mysql80-community-release-el7-3.noarch.rpm 
[root@VM-0-17-centos ~]# yum makecache
[root@VM-0-17-centos ~]# yum repolist 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
repo id                                             repo name                                            status
epel/7/x86_64                                       EPEL for redhat/centos 7 - x86_64                      13,441
extras/7/x86_64                                     Qcloud centos extras - x86_64                             413
mysql-connectors-community/x86_64                   MySQL Connectors Community                                165
mysql-tools-community/x86_64                        MySQL Tools Community                                     115
mysql80-community/x86_64                            MySQL 8.0 Community Server                                193
os/7/x86_64                                         Qcloud centos os - x86_64                            10,068+2
updates/7/x86_64                                    Qcloud centos updates - x86_64                          1,127
repolist: 25,522
[root@VM-0-17-centos ~]# yum -y install mysql-community-server.x86_64 
[root@VM-0-17-centos ~]# yum -y install mysql-community-libs-compat.x86_64  mysql-community-devel.x86_64 
[root@VM-0-17-centos ~]# sed -i "/datadir=/s/\/var\/lib\/mysql/\/wordpress\/mysql/"  /etc/my.cnf     # 将数据库的默认存放位置修改为/wordpress/mysql

# 执行数据库的初始化,ps:执行数据库初始化之前一定要确保/var/lib/mysql目录下是空的,否则无法执行初始化
[root@VM-0-17-centos ~]# mysqld --initialize-insecure --user=mysql -- datadir=/wordpress/mysql
[root@VM-0-17-centos ~]# chown -R  mysql.mysql  /wordpress/mysql
[root@VM-0-17-centos ~]# systemctl start mysqld
[root@VM-0-17-centos ~]# ss -nutlp | grep 3306
tcp    LISTEN     0      70     [::]:33060              [::]:*                   users:(("mysqld",pid=13455,fd=31))
tcp    LISTEN     0      128    [::]:3306               [::]:*                   users:(("mysqld",pid=13455,fd=33))
[root@VM-0-17-centos ~]# mysql -e "alter user root@'localhost' identified by 'tian1234.Q' "    # 修改密码
[root@VM-0-17-centos ~]# sed -i '4a default_authentication_plugin=mysql_native_password' /etc/my.cnf   # 更改默认的身份认证插件,需要重启服务才能生效
[root@VM-0-17-centos ~]# systemctl restart mysqld
[root@VM-0-17-centos ~]# ss -nutlp |  grep 3306
tcp    LISTEN     0      70     [::]:33060              [::]:*                   users:(("mysqld",pid=16656,fd=31))
tcp    LISTEN     0      128    [::]:3306               [::]:*                   users:(("mysqld",pid=16656,fd=33))
安装Nginx
[root@VM-0-17-centos ~]#  wget -P /opt http://nginx.org/download/nginx-1.18.0.tar.gz
[root@VM-0-17-centos ~]# wget -P /opt https://wordpress.org/latest.zip
[root@VM-0-17-centos ~]# yum -y install make gcc openssl-devel pcre-devel zlib-devel
[root@VM-0-17-centos ~]# cd /opt/-1.18.0
[root@VM-0-17-centos nginx-1.18.0]# ./configure   --prefix=/wordpress/nginx    --user=nginx   --group=nginx  --with-http_ssl_module  --with-stream  --with-debug  --with-http_realip_module  --with-http_gzip_static_module  --with-stream_realip_module   --with-http_gunzip_module  --with-http_stub_status_module  --with-stream_ssl_module   --with-http_v2_module  --with-http_dav_module  --with-http_flv_module   --with-http_addition_module --with-http_mp4_module

[root@VM-0-17-centos nginx-1.18.0]# make && make install
[root@VM-0-17-centos nginx-1.18.0]# useradd -s /sbin/nologin nginx -M
[root@VM-0-17-centos nginx-1.18.0]# cd /wordpress/nginx
[root@VM-0-17-centos nginx]# vim conf/nginx.conf
http {
    include       mime.types;              # 主模块指令,实现对配置文件所包含的文件设定,可以减少主配置文件的复杂度,类似apache中的include方法。
    default_type  application/octet-stream;  # 属于http核心模块指令,这里默认类型为二进制流,也就是当文件类型未定义是使用这种方式,例如在没有配置php环境时,nginx是不予解析的,此时,用浏览器访问php文件就会出现下载窗口                                                                                                                 
    server_tokens off;                     # 隐藏版本号
    server_names_hash_bucket_size 512;     # 服务器名字的hash表大小
    client_header_buffer_size 32k;         # 请求行+请求头的标准大小为32k
    large_client_header_buffers 4 32k;     # 请求行(request line)的大小不能超过32k,否则返回414错误,请求头(request header)中的每一个头部字段的大小不能超过32k,否则返回400错误(实际是494错误,但nginx统一返回400了),curl -H "header1=aaa" -H "header2=bbb" -v http://127.0.0.1/,这里的header1=xxx和header2=xxx就是请求头中的头部字段,(请求行+请求头)的大小不能超过128k(4 * 32k)
    client_max_body_size 50m;              # 上传文件大小限制

# FastCGI相关参数是为了改善网站的性能:减少资源占用,提高访问速度。
    fastcgi_connect_timeout 300;           # 指定连接到后端fastcgi的超时时间
    fastcgi_send_timeout 300;              # 向fastCGI请求的超时时间,这个值是指已经完成两次握手后向fastCGI传送的超时时间
    fastcgi_read_timeout 300;              # 接收fastCGI应答的超时时间,这个值已经完成两次握手后接收fastCGI应答的超时时间
    fastcgi_buffer_size 64k;               # 指定读取fastCGI应答第一部分需要用多大的缓冲区,一般第一部分应答不会超过1k,一般设置为64k
    fastcgi_buffers 4 64k;                 # 指定本地需要用多少和多大的缓冲区来缓冲fastCGI的应答
    fastcgi_busy_buffers_size 128k;        # 默认值是fastcgi_buffers的两倍
    fastcgi_temp_file_write_size 256k;     # 在写入fastcgi_temp_path是用多大的数据块,默认值是fastcgi_buffers两倍
    fastcgi_intercept_errors on;           # 这个指令指定是否传递4xx和5xx错误信息到客户端,或者允许nginx使用error_page处理错误信息。                       
    tcp_nodelay on;                        # 这个选项在将连接转变为长连接的时候才被启用,或者在upstream发送响应到客户端时也会启用。 
    keepalive_timeout 65;                  # 一个请求完成之后还要保持连接多久,不是请求时间多久,目的是保持长连接,减少创建连接过程给系统带来的性能损耗,类似于线程池,数据库连接池。

    gzip on;                               # 开启gzip压缩输出
    gzip_min_length 1k;                    # 用于设置允许压缩的页面最小字节数,页面字节数从header头的content-length中获取,默认值是0,不管页面多大都进行压缩,建议设置成大于1k的字节数,小于1k可能会越压越大
    gzip_buffers 4 16k;                    # 表示申请4个单位为16k的内存作为压缩结果流缓存,默认值是申请与原始数据大小相同的内存空间来存储gzip压缩结果
    gzip_http_version 1.1;                 # 压缩版本(默认1.1,前端如果是squid2.5请使用1.0)
    gzip_comp_level 2;                     # 压缩等级
    gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;                           # 压缩的类型
    gzip_vary on;                          # 使前端的缓存服务器缓存经过gzip压缩的页面
    gzip_proxied expired no-cache no-store private auth;           # 当请求头的信息来自代理服务器时,在请求头中包含expired则开启压缩
    gzip_disable "MSIE [1-6]\.";           # 禁用IE6的gzip压缩

    limit_conn_zone $binary_remote_addr zone=perip:10m;   # 指令指定一个会话的最大同时连接数,超过这个数字的请求将被返回”Service unavailable” (503)代码。
    limit_conn_zone $server_name zone=perserver:10m;      # 指令描述会话状态存储区域。会话的数目按照指定的变量来决定,它依赖于使用的变量大小和memory_max_size的值
    include /wordpress/nginx/myweb/*.conf;             
 67     server {
 68         listen       80;
 69         server_name  106.54.95.242;   # 改为自己的ip      
 
 
[root@VM-0-17-centos nginx]# mkdir www myweb
[root@VM-0-17-centos nginx]# cd myweb/
[root@VM-0-17-centos myweb]# touch  wordpress.conf
[root@VM-0-17-centos myweb]# vim wordpress.conf 
server {
    listen      80;
    server_name tianatian.icu ;
location / {
    root   /wordpress/nginx/www/wordpress;
    index index.php index.html index.htm;
    #charset koi8-r;
}
    #access_log  "pipe:rollback logs/host.access_log interval=1d baknum=7 maxsize=2G"  main;
    error_page 500 502 503 504  /50x.html ;
    location = /50x.html {
        root html;
}
location ~ \.php$ {
    root              /wordpress/nginx/www/wordpress; 
    fastcgi_pass      127.0.0.1:9000;
    fastcgi_index     index.php;
    include           fastcgi.conf;
    }
}
# 将Wordpress传到Nginx目录下面,使WordPress可以被访问
[root@VM-0-17-centos myweb]# cd /opt/
[root@VM-0-17-centos opt]# ls                        # 上传WordPress软件包
latest.zip                                  nginx-1.18.0         wordpress-5.4.2-zh_CN.tar.gz
mysql80-community-release-el7-3.noarch.rpm  nginx-1.18.0.tar.gz
[root@VM-0-17-centos opt]# tar -xf wordpress-5.4.2-zh_CN.tar.gz 
[root@VM-0-17-centos opt]# mv wordpress  /wordpress/nginx/www/
安装php
[root@VM-0-17-centos opt]# wget https://www.php.net/distributions/php-7.3.22.tar.gz
[root@VM-0-17-centos opt]# yum -y install zlib zlibxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2 libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel openssl-devel libxslt-devel libicu-devel gcc-c++
[root@VM-0-17-centos opt]# tar -xf  php-7.3.22.tar.gz 
[root@VM-0-17-centos opt]# cd php-7.3.22/
[root@VM-0-17-centos php-7.3.22]# ./configure  \
> --prefix=/wordpress/php   \
> --with-fpm-user==php --with-fpm-group=php \
> --with-mysqli=mysqlnd \
> --enable-embedded-mysqli \
> --with-mysql-sock=/var/lib/mysql/mysql.sock \
> --with-pdo-mysql=mysqlnd \
> --enable-mysqlnd \
> --with-zlib \
> --enable-fpm \
> --with-openssl \
> --enable-debug \
> --with-freetype-dir \
> --with-png-dir \
> --with-gd \
> --enable-gd-jis-conv \
> --with-jpeg-dir \
> --enable-sockets \
>  --enable-mbstring \
> --enable-bcmath \
> --with-config-file-path=/wordpress/php/etc  \
> --with-libxml-dir \
> --with-curl \
> --enable-ftp \
> --enable-intl \
> --with-mhash \
> --enable-soap \
> --enable-maintainer-zts \
> --with-pear \
> --disable-fileinfo \
> --disable-rpath \
> --with-gettext --enable-sysvsem \
> --enable-cli \
> --enable-phpdbg-readline=/wordpress/php/etc       # 此路径写php配置文件路径
[root@VM-0-17-centos php-7.3.22]# cp php.ini-production   /wordpress/php/etc/php.ini
[root@VM-0-17-centos php-7.3.22]# cp sapi/fpm/init.d.php-fpm    /wordpress/php/bin/php-fpm
[root@VM-0-17-centos php-7.3.22]# cp /wordpress/php/etc/php-fpm.conf.default  /wordpress/php/etc/php-fpm.conf
[root@VM-0-17-centos php-7.3.22]# cp /wordpress/php/etc/php-fpm.d/www.conf.default   /wordpress/php/etc/php-fpm.d/www.conf
[root@VM-0-17-centos php-7.3.22]# chmod +x /wordpress/php/bin/php-fpm
[root@VM-0-17-centos php-7.3.22]# useradd -s /sbin/nologin  php  -M
起服务
[root@VM-0-17-centos ~]# /wordpress/nginx/sbin/nginx
[root@VM-0-17-centos ~]# ss -nutlp |  grep :80
tcp    LISTEN     0      128       *:80                    *:*                   users:(("nginx",pid=10027,fd=6),("nginx",pid=10026,fd=6))
[root@VM-0-17-centos ~]# systemctl start mysqld
[root@VM-0-17-centos ~]# systemctl enable mysqld
[root@VM-0-17-centos ~]# ss -nutlp |  grep 3306
tcp    LISTEN     0      70     [::]:33060              [::]:*                   users:(("mysqld",pid=16656,fd=31))
tcp    LISTEN     0      128    [::]:3306               [::]:*                   users:(("mysqld",pid=16656,fd=33))
[root@VM-0-17-centos ~]# /wordpress/php/bin/php-fpm start
Starting php-fpm  done
[root@VM-0-17-centos ~]# ss -nutlp |  grep 9000
tcp    LISTEN     0      128    127.0.0.1:9000                  *:*                   users:(("php-fpm",pid=12052,fd=5),("php-fpm",pid=12051,fd=5),("php-fpm",pid=12050,fd=7))
创建一个数据库wordpress
[root@VM-0-17-centos ~]# mysql -uroot -ptian1234.Q
mysql> create database wordpress character set utf8mb4;
Query OK, 1 row affected (0.01 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| wordpress          |
+--------------------+
5 rows in set (0.01 sec)
mysql> create user wordpress@"localhost" identified by "123qqq...A";
Query OK, 0 rows affected (0.02 sec)
mysql> grant all privileges on wordpress.* to wordpress@"localhost";
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

[root@VM-0-17-centos ~]# vim /etc/my.cnf
[mysqld]
default_authentication_plugin=mysql_native_password
port=3306
server_id=1
log-bin=mysql-bin
slow_query_log=1
slow-query-log-file=/var/log/mysql-slow.log
long_query_time=3  

[root@VM-0-17-centos ~]# systemctl restart mysqld
[root@VM-0-17-centos ~]# ss -nutlp |  grep mysqld
tcp    LISTEN     0      70     [::]:33060              [::]:*                   users:(("mysqld",pid=26208,fd=31))
tcp    LISTEN     0      128    [::]:3306               [::]:*                   users:(("mysqld",pid=26208,fd=33))
DNS解析

在这里插入图片描述

在这里插入图片描述在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

配置ssl证书
# 注意:证书的位置必须是在nginx安装目录下的cert这个目录里
# 当证书状态变为已颁发,下载证书的zip压缩包上传到Nginx安装目录的cert中

[root@VM-0-17-centos ~]# cd /wordpress/nginx/
[root@VM-0-17-centos nginx]# mkdir cert
[root@VM-0-17-centos nginx]# cd  cert
# 上传证书压缩包
[root@VM-0-17-centos cert]# ls
tianatian.icu.zip  www.tianatian.icu.zip

# 解压缩
[root@VM-0-17-centos cert]# unzip  tianatian.icu.zip
[root@VM-0-17-centos cert]# unzip  www.tianatian.icu.zip

# 修改配置文件
[root@VM-0-17-centos cert]# cd ../myweb/
[root@VM-0-17-centos myweb]# vim wordpress.conf 
server {
    listen      80; 
    server_name tianatian.icu ;                    # 换成自己的域名
    return      301  https://$server_name$request_uri;      # 重定向
location / {
    root   /wordpress/nginx/www/wordpress;
    index index.php index.html index.htm;
    #charset koi8-r;
     }
}
server {
    listen 443 ssl;
    server_name tianatian.icu;
    root www/wordpress; 
    index index.php index.html index.htm; 
    ssl_certificate /wordpress/nginx/cert/Nginx/1_tianatian.icu_bundle.crt;         # 换成刚刚解压缩后的crt证书文件名
    ssl_certificate_key /wordpress/nginx/cert/Nginx/2_tianatian.icu.key;            # 换成刚刚解压缩后的key密钥文件名       
    ssl_session_timeout 5m; 
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; 
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 
    ssl_prefer_server_ciphers on; 
    
    # 配置跨域访问
    location / { 
    add_header 
    Access-Control-Allow-Origin *; 
    add_header Access-Control-Allow-Headers X-Requested-With; 
    add_header Access-Control-Allow-Methods GET,POST,OPTIONS; 
    proxy_redirect off; 
    proxy_set_header Host $host; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header X-Forwarded-Proto https; 
    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; 
    }

location ~ \.php$ {
    root              /wordpress/nginx/www/wordpress; 
    fastcgi_pass      127.0.0.1:9000;
    fastcgi_index     index.php;
    include           fastcgi.conf;
    }
}


# 重启服务
[root@VM-0-17-centos myweb]# ../sbin/nginx -t
nginx: the configuration file /wordpress/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /wordpress/nginx/conf/nginx.conf test is successful
[root@VM-0-17-centos myweb]# ../sbin/nginx -s reload
[root@VM-0-17-centos myweb]# ss -nutlp |  grep  nginx
tcp    LISTEN     0      128       *:443                   *:*                   users:(("nginx",pid=16419,fd=10),("nginx",pid=10026,fd=10))
tcp    LISTEN     0      128       *:80                    *:*                   users:(("nginx",pid=16419,fd=6),("nginx",pid=10026,fd=6))
访问域名进行安装
  • 左上角出现小锁头表示https协议已经生效,点击现在就开始
    在这里插入图片描述

  • 填写数据库的用户名密码信息,点击提交
    在这里插入图片描述

  • 手动写入wp-config.php文件到网页的根目录

在这里插入图片描述

# 将提示文件复制到网页的根目录中
[root@VM-0-17-centos ~]# cd /wordpress/nginx/www/wordpress/
[root@VM-0-17-centos wordpress]# vim wp-config.php
<?php
/**
 * WordPress基础配置文件。
 *
 * 这个文件被安装程序用于自动生成wp-config.php配置文件,
 * 您可以不使用网站,您需要手动复制这个文件,
 * 并重命名为“wp-config.php”,然后填入相关信息。
 *
 * 本文件包含以下配置选项:
 *
 * * MySQL设置
 * * 密钥
 * * 数据库表名前缀
 * * ABSPATH
 *
 * @link https://codex.wordpress.org/zh-cn:%E7%BC%96%E8%BE%91_wp-config.php
 *
 * @package WordPress
 */

// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define( 'DB_NAME', 'wordpress' );

/** MySQL数据库用户名 */
define( 'DB_USER', 'wordpress' );

/** MySQL数据库密码 */
define( 'DB_PASSWORD', '123qqq...A' );

/** MySQL主机 */
define( 'DB_HOST', 'localhost' );

/** 创建数据表时默认的文字编码 */
define( 'DB_CHARSET', 'utf8mb4' );

/** 数据库整理类型。如不确定请勿更改 */
define( 'DB_COLLATE', '' );

/**#@+
 * 身份认证密钥与盐。
 *
 * 修改为任意独一无二的字串!
 * 或者直接访问{@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org密钥生成服务}
 * 任何修改都会导致所有cookies失效,所有用户将必须重新登录。
 *
 * @since 2.6.0
 */
define( 'AUTH_KEY',         '25q<}/ztS2t@tlu:|SWu|4~,c0{8$-SBqxH|An@Y<u4Da#B!<AdZ7#zku)!<uF^y' );
define( 'SECURE_AUTH_KEY',  '1[C:RfT$DtJ`C{jg&%VI]lb2dPlur&f$V%&P/!Ecinh^4SK1^zUq9.Z8~b<?tQ%B' );
define( 'LOGGED_IN_KEY',    'C2D3Dh1:>4Io5a;Dn_xZC3WELT>a(,%XiQ)~~#;S?<=+/BHwMof)K}~PKX>F>lx.' );
define( 'NONCE_KEY',        'r$>;}<Uyd$~LhQn^MCMN#,/g,_L}usYn%c}hzTzxAR+0Oo#doF0 _8hY3<Wi|R3T' );
define( 'AUTH_SALT',        '(5SNjDi2i_}3bq6D=?m`nn;vuRgJ%e)Zk`KdsaRtrWgu_N*rrzU$X(;1f:DW`#4T' );
define( 'SECURE_AUTH_SALT', '97=?jnn0<rHdij.0;@kfOk*Gn_o[J)9Rj<NKUeI9E6K|}xi#t&.*l|L/xLu&s#&@' );
define( 'LOGGED_IN_SALT',   '1-OSp5ruxbkG<Js-v?}*s4}$lyE3Fn(dx3)1@:^T;;%Y;MQ]uR,3^z&}ty~;2OGI' );
define( 'NONCE_SALT',       'Jmn:o{,H>9r;[_kM=t{l@R>8]|-iI$`3t(_uh-X5<|C]?u_<7]yvm35@tLb/PU{d' );

/**#@-*/

/**
 * WordPress数据表前缀。
 *
 * 如果您有在同一数据库内安装多个WordPress的需求,请为每个WordPress设置
 * 不同的数据表前缀。前缀名只能为数字、字母加下划线。
 */
$table_prefix = 'wp_';

/**
 * 开发者专用:WordPress调试模式。
 *
 * 将这个值改为true,WordPress将显示所有用于开发的提示。
 * 强烈建议插件开发者在开发环境中启用WP_DEBUG。
 *
 * 要获取其他能用于调试的信息,请访问Codex。
 *
 * @link https://codex.wordpress.org/Debugging_in_WordPress
 */
define('WP_DEBUG', false);

/* 好了!请不要再继续编辑。请保存本文件。使用愉快! */

/** WordPress目录的绝对路径。 */
if ( ! defined( 'ABSPATH' ) ) {
	define( 'ABSPATH', dirname( __FILE__ ) . '/' );
}

/** 设置WordPress变量和包含文件。 */
require_once( ABSPATH . 'wp-settings.php' );
  • 返回web页面继续下一步安装
    在这里插入图片描述

  • 输入用户名密码登录

在这里插入图片描述

在这里插入图片描述

ftp问题

在这里插入图片描述

# 每当我们想在wordpress上升级插件或者是升级wordpress的时候,就会弹出一个ftp登录,但是我们怎么跳过ftp登录呢
[root@VM-0-17-centos wordpress]# vim wp-config.php
define("FS_METHOD","direct");
define("FS_CHMOD_DIR", 0777);
define("FS_CHMOD_FILE", 0777);

[root@VM-0-17-centos wordpress]# chown -R 777 /wordpress/nginx/www/wordpress/
[root@VM-0-17-centos wordpress]# chown -R  nginx:nginx  /wordpress/nginx/www/wordpress/

此时再次去到仪表板,点击更新就不再提示输入ftp了

在这里插入图片描述

其他问题
在更新Akismet Anti-Spam时发生了错误:无法创建目录

# 解决办法:简单粗暴
[root@VM-0-17-centos wordpress]# pwd
/wordpress/nginx/www/wordpress
[root@VM-0-17-centos wordpress]# ll
total 212
-rw-r--r--  1 777 nginx   405 Feb  6  2020 index.php
-rw-r--r--  1 777 nginx 19915 Feb 12  2020 license.txt
-rw-r--r--  1 777 nginx  7005 Aug  3 12:00 readme.html
-rw-r--r--  1 777 nginx  6912 Feb  6  2020 wp-activate.php
drwxr-xr-x  9 777 nginx  4096 Aug  3 12:00 wp-admin
-rw-r--r--  1 777 nginx   351 Feb  6  2020 wp-blog-header.php
-rw-r--r--  1 777 nginx  2332 Jun  3 04:26 wp-comments-post.php
-rw-r--r--  1 777 nginx  3062 Sep 15 10:49 wp-config.php
-rw-r--r--  1 777 nginx  2776 Aug  3 12:00 wp-config-sample.php
drwxr-xr-x  5 777 nginx  4096 Aug  3 12:00 wp-content
-rw-r--r--  1 777 nginx  3940 Feb  6  2020 wp-cron.php
drwxr-xr-x 21 777 nginx 12288 Aug  3 12:00 wp-includes
-rw-r--r--  1 777 nginx  2496 Feb  6  2020 wp-links-opml.php
-rw-r--r--  1 777 nginx  3300 Feb  6  2020 wp-load.php
-rw-r--r--  1 777 nginx 47874 Feb 10  2020 wp-login.php
-rw-r--r--  1 777 nginx  8509 Apr 14 19:34 wp-mail.php
-rw-r--r--  1 777 nginx 19396 Apr 10 11:59 wp-settings.php
-rw-r--r--  1 777 nginx 31111 Feb  6  2020 wp-signup.php
-rw-r--r--  1 777 nginx  4755 Feb  6  2020 wp-trackback.php
-rw-r--r--  1 777 nginx  3133 Feb  6  2020 xmlrpc.php
[root@VM-0-17-centos wordpress]# chmod 777 -R   .
[root@VM-0-17-centos wordpress]# ll
total 212
-rwxrwxrwx  1 nginx nginx   405 Feb  6  2020 index.php
-rwxrwxrwx  1 nginx nginx 19915 Feb 12  2020 license.txt
-rwxrwxrwx  1 nginx nginx  7005 Aug  3 12:00 readme.html
-rwxrwxrwx  1 nginx nginx  6912 Feb  6  2020 wp-activate.php
drwxrwxrwx  9 nginx nginx  4096 Aug  3 12:00 wp-admin
-rwxrwxrwx  1 nginx nginx   351 Feb  6  2020 wp-blog-header.php
-rwxrwxrwx  1 nginx nginx  2332 Jun  3 04:26 wp-comments-post.php
-rwxrwxrwx  1 nginx nginx  3062 Sep 15 10:49 wp-config.php
-rwxrwxrwx  1 nginx nginx  2776 Aug  3 12:00 wp-config-sample.php
drwxrwxrwx  5 nginx nginx  4096 Aug  3 12:00 wp-content
-rwxrwxrwx  1 nginx nginx  3940 Feb  6  2020 wp-cron.php
drwxrwxrwx 21 nginx nginx 12288 Aug  3 12:00 wp-includes
-rwxrwxrwx  1 nginx nginx  2496 Feb  6  2020 wp-links-opml.php
-rwxrwxrwx  1 nginx nginx  3300 Feb  6  2020 wp-load.php
-rwxrwxrwx  1 nginx nginx 47874 Feb 10  2020 wp-login.php
-rwxrwxrwx  1 nginx nginx  8509 Apr 14 19:34 wp-mail.php
-rwxrwxrwx  1 nginx nginx 19396 Apr 10 11:59 wp-settings.php
-rwxrwxrwx  1 nginx nginx 31111 Feb  6  2020 wp-signup.php
-rwxrwxrwx  1 nginx nginx  4755 Feb  6  2020 wp-trackback.php
-rwxrwxrwx  1 nginx nginx  3133 Feb  6  2020 xmlrpc.php
此时重新查看,可以发现插件已经可以更新了
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值