wordpress快速仿站教程(wp怎么做网站还有前途吗)

wordpress搭建教程,wp网站搭建教程,wordpress快速搭建

WordPress搭建教程,WordPress是一款使用PHP语言开发的博客平台,站长可使用通过WordPress搭建属于个人的网站。本文主要分享如何wordpress建站的wordpress搭建教程,从服务器配置、域名解析、面板设置、wordpress建站、网站优化等一些列操作讲解wordpress搭建教程,站长可以学习到的不仅仅是如何成功搭建一个Wordpress网站,更多的是学习Wordpress网站优化,Wordpress可以很强大,但是前提是站长已经掌握了它。

wordpress快速仿站教程(wp怎么做网站还有前途吗)

wordpress搭建教程技巧分享,详细步骤说明如下:

Linux:Linux 操作系统,以ubuntu18.04 为例;Nginx:Web 服务器;mysql:数据库;PHP:脚本语言;CMS:wordpress,操作步骤:

wordpress快速仿站教程(wp怎么做网站还有前途吗)

wordpress搭建教程步骤1:登录云服务器

win系统建议使用Xshell

Mac以及ubuntu系统可以使用自带的终端

ssh-p端口号服务器用户名@ip(例如ssh-p22 username@111.222.111.222)

wordpress快速仿站教程(wp怎么做网站还有前途吗)

wordpress搭建教程步骤2:搭建环境

apt update && apt upgrade

apt install -y nginx mysql-server unzip python-certbot-nginx

apt install -y php php-fpm php-mysql php-gd php-json php-xml php-mbstring

wordpress快速仿站教程(wp怎么做网站还有前途吗)

wordpress搭建教程步骤3:配置数据库

执行以下命令,进入mysql

mysql

执行以下命令,创建 mysql 数据库。例如 “wordpress”

CREATE DATABASE wordpress;

执行以下命令,创建一个新用户。例如 “user”,登录密码为 123456

CREATE USER ‘user’@’localhost’ IDENTIFIED BY ‘123456’;

执行以下命令,创建一个新用户。例如 “user”,登录密码为 123456

GRANT ALL PRIVILEGES ON wordpress.* TO ‘user’@’localhost’ IDENTIFIED BY ‘123456’;

执行以下命令,退出 mysql

q

wordpress快速仿站教程(wp怎么做网站还有前途吗)

wordpress搭建教程步骤4:安装和配置 WordPress

下载并解压WordPress软件包

wget WordPress/latest.zip && unzip latest.zip

设置目录权限

chown -R www-data:www-data wordpress/

wordpress搭建教程步骤5:域名解析获取https证书

域名解析一般设置两条记录就够了,即将域名指向站长自己VPS的 IP地址

申请https证书这里使用 Let’s Encrypt 免费证书

配置 Nginx 以便于 Let’s Encrypt 能起作用:

sudo vim /etc/nginx/sites-enabled/default

default替换成你自己的Nginx配置文件名,清空原有内容并添加下面的配置

server {

listen 80;

listen [::]:80;

server_name 你的域名;

}

保存退出之后,执行以下命令来检测 Nginx 的配置文件是否有错

sudo nginx -t

如果出现这样的语句,就说明 Nginx 的配置文件没有问题

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

重新加载 Nginx 的配置文件了

sudo nginx -s reload

执行命令获取证书

sudo certbot –nginx -d 你的域名

如果第一次运行 certbot 命令的话,需要在弹出的窗口输入站长的邮箱地址还有需要接受 Let’s Encrypt 的协议,执行完后,就会有输出一段字符

然后在文字中,这个/etc/letsencrypt/live/你的域名/fullchain.pem 路径很重要,就是你的 SSL 证书路径。

自动更新证书

因为 Let’s Encrypt 签发的证书有效期只有 90 天,所有在过期之前,我们需要自动更新 SSL 证书,而如果你使用最新的 certbot 的话,Let’s Encrypt 会帮你添加自动更新的脚本到 /etc/cron.d 里,你只需要去检测一下这个命令是否生效就OK!

sudo certbot renew –dry-run

如果这个命令你没看到什么 error 的话,那就是没什么问题了。

wordpress搭建教程步骤6:配置nginx

打开第五步设置的Nginx配置文件名

sudo vim /etc/nginx/sites-enabled/default

在ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot后加入如下内容

root /home/wordpress;

## This should be in your http block and if it is, it’s not needed here.

client_max_body_size 10M;

index index.php;

location = /favicon.ico {

log_not_found off;

access_log off;

}

location = /robots.txt {

allow all;

log_not_found off;

access_log off;

location / {

# This is cool because no php is touched for static content.

# include the “?$args” part so non-default permalinks doesn’t break when using query string

try_files $uri $uri/ /index.php?$args;

}

location ~ .php$ {

#NOTE: You should have “cgi.fix_pathinfo = 0;” in php.ini

include fastcgi.conf;

fastcgi_intercept_errors on;

fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;

client_max_body_size 10m;

}

location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {

expires max;

log_not_found off;

}

保存退出之后,执行以下命令来检测 Nginx 的配置文件是否有错

sudo nginx -t

如果出现这样的语句,就说明 Nginx 的配置文件没有问题

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

重新加载 Nginx 的配置文件了

sudo nginx -s reload

wordpress搭建教程步骤7:初始化wordpress

搭建完成,访问站点,“现在开始”,按提示配置 WordPress。

填写上面记录下的数据库信息,提交。

填写网站标题以及设置管理员账号密码

登后台

wordpress搭建教程的总体过程已经分享给大家,希望对大家能有所帮助,如果还有不明白,可以结合文章图片来阅读,快速完成一键建站。

wordpress快速仿站教程(wp怎么做网站还有前途吗)

本文来自投稿,不代表本站立场,转载请注明:https://www.qingyangmei.com/99732.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 87833061@qq.com 举报,一经查实,本站将立刻删除。