基于 MacOS 搭建 WordPress

WordPress 是一款通过使用 PHP 语言开发的博客平台,开发者可以通过 WordPress 搭建属于自己的个人博客平台,本文基于 Mac 操作系统搭建 WordPress 个人站点,并将静态文件部署到 Github。

一、搭建本地开发环境

Mac 操作系统下,通过 MAMP 搭建本地开发环境,它是由苹果 OSX 系统上集成的 Apache、Macintosh、MySQL 和 PHP 等软件包,可以在本地模拟网络空间,下载链接 https://www.mamp.info/en/mac/

下载完 MAMP 安装包,直接解压打开,双击安装,点击“下一步”,安装 MAMP 之后,打开 MAMP 版本,Pro 版本是需要收费的,选择免费的 MAMP 即可。

点击“Preferences…”—>”Web Server”—>”Document Root” 重新选择网站重新目录,该目录存放网站程序。

二、安装网站程序

WordPress 官网下载 WordPress。

① 解压 WordPress 到设置的 Document root
① Start
① phpMyAdmin 或在页面顶部 Menu 的 Tools 中可以找到
① 新建
① 输入数据库名称
② 创建
在浏览器中打开 localhost/wordpress 或 localhost:8888
① 现在就开始
① 输入数据库名称
② 输入 root
③ 输入 root
④ 提交
① 运行安装程序
① 输入站点标题
② 输入用户名
③ 输入密码
④ 输入您的电子邮件地址
⑤ 可选
⑥ 安装 WordPress
① 登录
安装完成

三、部署到 Github

Github Pages 是面向用户、组织和项目开放的公共静态页面搭建托管服务,站点可以被免费托管在 Github 上,我们可以选择使用 Github Pages 默认提供的域名 github.io 或者自定义域名来发布站点。Github Pages 支持自动利用 Jekyll 生成站点,也同样支持纯 HTML 文档。因此,想要将搭建的个人站点托管在 Github,就需要将其静态化。

插件市场搜索 static,下载插件 Simply Static,下载量最高,使用也比较方便,但缺点是不支持文章 url 有中文名,可以在设置-固定链接中进行修改。此外,还可以在设置中选择下载生成的静态文件压缩包或直接将静态文件生成到指定路径。然后,就可以将生成的文件部署到 Github,并通过域名访问。

Github Page 的创建可参考 https://blog.csdn.net/Tang_Chuanlin/article/details/83626545

About the author

Tang

Principal investigator of the National Training Program of Innovation and Entrepreneurship for Undergraduates.
Recipient of the Excellent Undergraduate Graduation Design (Thesis) of Beijing Ordinary Colleges and Universities.

Add Comment

By Tang

Tang

Principal investigator of the National Training Program of Innovation and Entrepreneurship for Undergraduates.
Recipient of the Excellent Undergraduate Graduation Design (Thesis) of Beijing Ordinary Colleges and Universities.

Get in touch

Quickly communicate covalent niche markets for maintainable sources. Collaboratively harness resource sucking experiences whereas cost effective meta-services.