江明涛的博客
wordpress 安装
wordpress 安装

wordpress 安装

下载 wordpress 安装包

wordpress 官网:https://wordpress.org/

下载并配置wordpress

下载wordpress安装包

#创建并切换目录
mkdir /var/www && cd /var/www
#下载 wordpress 安装包
wget https://wordpress.org/latest.tar.gz
#解压wordpress安装包
tar -xvf latest.tar.gz
#重命令
mv wordpress www.jiangmingtao.com

配置wordpress

#切换至wordpress 目录
cd www.jiangmingtao.com
#创建配置文件
cp wp-config-sample.php wp-config.php
#编辑配置文件
vim wp-config.php
define( 'DB_NAME', 'database_name_here' );#你的数据库名
define( 'DB_USER', 'username_here' );#你的数据库登录名
define( 'DB_PASSWORD', 'password_here' );#你的数据库登录密码
define( 'DB_HOST', 'localhost:3306' );#你的数据库连接地址
define( 'DB_CHARSET', 'utf8' );#创建数据表时编码
$table_prefix = 'wp_';#数据库表名前缀,默认wp_ 建议修改为自定义前缀

配置nginx

#nginx 配置文件所在位置要被你的nginx.conf加载
#如果开启https则需要配置证书
vim www.jiangmingtao.com.conf 
server {
      listen       80;
     # listen       443 ssl;
      server_name  www.jiangmingtao.com;
      root         /var/www/www.jiangmingtao.com;
      index index.php index.html index.hml;

       # ssl                  off;
       # ssl_certificate      /etc/nginx/cert/www.jiangmingtao.com/fullchain.pem;
       # ssl_certificate_key  /etc/nginx/cert/www.jiangmingtao.com/privkey.pem;

       # ssl_session_timeout  5m;

       # ssl_protocols  SSLv2 SSLv3 TLSv1;
       # ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
       # ssl_prefer_server_ciphers   on;


      location ~* \.php$ {
              fastcgi_pass 127.0.0.1:9000;
              fastcgi_index index.php;
              fastcgi_buffers      8 64K;
              fastcgi_buffer_size  64K;
              client_max_body_size 10m;
              client_body_buffer_size 128k;
              proxy_connect_timeout 90;
              proxy_send_timeout 90;
              proxy_read_timeout 90;
              proxy_buffer_size 128k;
              proxy_buffers 32 32k;
              proxy_busy_buffers_size 128k;
              proxy_temp_file_write_size 128k;
              fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
              include fastcgi_params;
      }

      location ~ /\.ht {
            deny  all;
     }
     if (-f $request_filename/index.html){
        rewrite (.*) $1/index.html break;
     }
     if (-f $request_filename/index.php){
        rewrite (.*) $1/index.php;
     }
     if (!-f $request_filename){
        rewrite (.*) /index.php;
     }
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;

}

使wordpress的nginx 配置文件生效

nginx -s reload

上次更新时间 13 3 月, 2023 at 09:59 上午