wordpress搭建的知名网站(wordpress搭建教程,wp网站搭建教程,wordpress快速搭建)

wufei123 发布于 2024-01-21 阅读(137)

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

wordpress搭建教程技巧分享,详细步骤说明如下:Linux:Linux 操作系统,以ubuntu18.04 为例;nginx:Web 服务器;mysql:数据库;PHP:脚本语言;CMS:WordPress,操作步骤:

wordpress搭建教程步骤1:登录云服务器win系统建议使用Xshell软件进行登陆Mac以及ubuntu系统可以使用自带的终端进行登陆ssh-p端口号服务器用户名@ip(例如ssh-p22 username@111.222.111.222)

wordpress搭建教程步骤2:搭建环境apt update && apt upgradeapt 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搭建教程步骤3:配置数据库执行以下命令,进入mysqlmysql执行以下命令,创建 mysql 数据库例如 “wordpress”CREATE DATABASE wordpress;执行以下命令,创建一个新用户。

例如 “user”,登录密码为 123456CREATE USER user@localhost IDENTIFIED BY 123456;执行以下命令,创建一个新用户例如 “user”,登录密码为 123456。

GRANT ALL PRIVILEGES ON wordpress.* TO user@localhost IDENTIFIED BY 123456;执行以下命令,退出 mysql\q

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/defaultdefault替换成你自己的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, its 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 doesnt break when using query stringtry_files $uri $uri/ /index.php?$args;

}location ~ \.php$ {#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.iniinclude 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 oknginx: configuration file /etc/nginx/nginx.conf test is successful

重新加载 Nginx 的配置文件了sudo nginx -s reloadwordpress搭建教程步骤7:初始化wordpress搭建完成,访问站点,“现在开始”,按提示配置 WordPress填写上面记录下的数据库信息,提交。

填写网站标题以及设置管理员账号密码登陆后台wordpress搭建教程的总体过程已经分享给大家,希望对大家能有所帮助,如果还有不明白,可以结合文章图片来阅读,快速完成一键建站。

亲爱的读者们,感谢您花时间阅读本文。如果您对本文有任何疑问或建议,请随时联系我。我非常乐意与您交流。

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。