6hz7vif 发表于 2024-7-1 15:43:19

3分钟教你怎么样在VPS上搭建Hexo!


    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">针对</span>想<span style="color: black;">创立</span>自己个人博客的用户,<span style="color: black;">意见</span>购买一款vps试一试,以下是搭建的流程。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">前期准备</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">爱好</span>Hexo的主题,不少都适合中文,配置简单,一键<span style="color: black;">颁布</span>,<span style="color: black;">因此</span><span style="color: black;">选取</span>它。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">关于<span style="color: black;">怎样</span>搭建 Hexo 的环境,<span style="color: black;">这儿</span>就不罗嗦了, Hexo官方文档<span style="color: black;">已然</span>讲解的非常<span style="color: black;">仔细</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">VPS 上安装 Nginx 服务</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">SSH 连接 VPS 后,添加 CenOS 7 的 epel 软件包: $ yum install epel-release</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">安装Nginx: $ yum install nginx</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">起步</span> Nginx: $ systemctl start nginx.service</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">运用</span> firewalld 给防火墙添加规则<span style="color: black;">准许</span> HTTP 以及 HTTPS</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://pic1.zhimg.com/80/v2-1994ac5d48758e7ca6e3303c76cda8c8_720w.webp" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">设置 Nginx 自动跟随系统<span style="color: black;">起步</span></p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">$ systemctl enable nginx.service</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">此刻</span><span style="color: black;">能够</span>在浏览器中输入 VPS 的 ip <span style="color: black;">检测</span>看 Nginx! <span style="color: black;">是不是</span><span style="color: black;">起步</span>了。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">倘若</span><span style="color: black;">显现</span> "Welcome to Nginx.." 的字样,恭喜!<span style="color: black;">表率</span>你的 Nginx 成功安装并<span style="color: black;">起步</span>。</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">VPS 上搭建 Hexo</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">方法</span><span style="color: black;">选取</span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://pic2.zhimg.com/80/v2-3c884080b0eb923f656fb0e9a62c44c9_720w.webp" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">毋庸置疑,为了安全起见并且在本地能<span style="color: black;">同期</span> Deploy 到 VPS 和 Github (用作备份)上,选第二中<span style="color: black;">办法</span>肯定是比较好的</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">运用</span> rsync 将 Hexo <span style="color: black;">安排</span>到 VPS 上</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在 Hexo 目录下安装 rsync : $ npm install hexo-deployer-rsync --save</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">按照</span> Hexo rsync <span style="color: black;">安排</span>文档 在 Hexo 中的 _config.yml 中添加 Deploy 的配置,以下是我在自己项目中的配置代码</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">*<span style="color: black;">必要</span>先在 VPS 上创建好了想要存放 Hexo 静态文件的目录, rsync <span style="color: black;">不可</span>创建不存在的目录</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">网上有的<span style="color: black;">伴侣</span>说光在 Hexo 中<span style="color: black;">运用</span> rsync <span style="color: black;">不足</span>,在 VPS <span style="color: black;">亦</span><span style="color: black;">必须</span>下载 rsync 服务,<span style="color: black;">然则</span>我在雷电VPS上就<span style="color: black;">无</span>下载 rsync 服务。<span style="color: black;">倘若</span>你在 Hexo 中用 rsync <span style="color: black;">安排</span>的时候<span style="color: black;">始终</span>报错,那就在 VPS 上下载 rsync 服务,看能否<span style="color: black;">处理</span><span style="color: black;">始终</span>出错的<span style="color: black;">原由</span>,命令如下:$ yum -y install rsync</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">配置 Nginx</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">Hexo 成功<span style="color: black;">安排</span>到 VPS 上之后,剩下的<span style="color: black;">便是</span>来配置 Nginx 了</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">$ vi /etc/nginx/conf.d/default.conf</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">将以下内容替换原内容</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://pic3.zhimg.com/80/v2-bb91c2d3dae51d4333f70125dbdc1f8a_720w.webp" style="width: 50%; margin-bottom: 20px;"></div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">重启一下 Nginx 服务</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">$ systemctl start nginx.service</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">$ systemctl enable nginx.service</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">这般</span>设置之后网站就应该<span style="color: black;">能够</span><span style="color: black;">经过</span> VPS 的 IP <span style="color: black;">地区</span><span style="color: black;">拜访</span>到了</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">申请域名及域名解析</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">至此在 VPS 上搭建 Hexo 并绑定域名就到此结束了</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">举荐</span></p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><a style="color: black;"><span style="color: black;"><span style="color: black;">3分钟教你<span style="color: black;">怎样</span>在VPS上搭建Hexo!-雷电VPS</span><span style="color: black;"><span style="color: black;">​</span>leidianvps.com/servers/shownews.asp?id=312</span></span><span style="color: black;"><img src="https://pic1.zhimg.com/v2-d2459687c6b4ac840961512a13fef548_180x120.jpg" style="width: 50%; margin-bottom: 20px;"></span></a></div>




流星的美 发表于 2024-8-30 12:32:51

同意、说得对、没错、我也是这么想的等。

sbxzw 发表于 2024-9-8 04:35:40

感谢您的精彩评论,为我带来了新的思考角度。

情迷布拉格 发表于 2024-9-10 09:11:24

楼主继续加油啊!外链论坛加油!

nqkk58 发表于 2024-10-12 07:48:27

大势所趋,用于讽刺一些制作目的就是为了跟风玩梗,博取眼球的作品。

qzmjef 发表于 前天 15:08

论坛的成果是显著的,但我们不能因为成绩而沾沾自喜。
页: [1]
查看完整版本: 3分钟教你怎么样在VPS上搭建Hexo!