在Arch Linux上使用Makepkg
在Arch Linux上使用Makepkg可以避免系统污染,确保仅安装必要的依赖关系。
自2013年发布以来,Ghost是一个开源博客平台,在开发人员和普通用户中越来越受欢迎。它把重点放在内容和博客上。Ghost最吸引人的地方是其简单,干净且响应迅速的设计。您可以通过手机撰写博客文章。Ghost的内容是使用Markdown语言编写的。幽灵非常适合个人或小组作家。
在本指南中,我们将使用Let's Encrypt,Certbot,Node.js,Nginx和PM2在Fedora 25 VPS上建立并部署安全的Ghost博客。
semanage port -a -t http_port_t -p tcp 2368。在开始此步骤之前,请确保已为您的域设置了DNS记录。
我们将使用Let's Encrypt CA和EFF的Certbot客户端获取Ghost博客的TLS证书。不要忘记将所有实例替换为example.com您的域名。
更新系统:
dnf check-update || dnf upgrade -y
安装所需的工具:
dnf install @development-tools -y
安装Certbot(又名“让我们加密客户端”):
dnf install certbot -y
检查Certbot版本:
certbot --version
# certbot 0.12.0
使用独立的”模式获取证书:
certbot certonly --standalone --domains example.com,www.example.com --email john.doe@example.com --agree-tos --rsa-key-size 2048
完成上述步骤后,您的证书和私钥将位于/etc/letsencrypt/live/example.com目录中。
幽灵目前支持节点版本0.12.x,4.2+和6.9+而已。
我们将v6 Boron LTS在撰写本文时为Ghost安装受支持的版本。
下载并安装最新的LTS版本的Node.js:
dnf install nodejs -y
检查节点和NPM版本:
node -v && npm -v
# v6.10.2
# 3.10.10
下载并安装Nginx:
dnf install nginx -y
检查Nginx版本:
nginx -v
# nginx version: nginx/1.10.2
启动并启用Nginx服务:
systemctl start nginx.service && systemctl enable nginx.service
将Nginx配置为反向代理:
vi /etc/nginx/conf.d/ghost.conf
将以下内容粘贴到中/etc/nginx/conf.d/ghost.conf:
server {
listen 80;
listen [::]:80;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name example.com www.example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:2368;
}
}
检查Nginx语法:
nginx -t
重新加载Nginx配置:
systemctl reload nginx.service
如果要在同一VPS上托管多个Ghost博客,则每个Ghost实例必须在单独的端口上运行。
制作webroot目录:
mkdir -p /var/www/
创建一个新的虚幻用户:
useradd -c "Ghost Application" ghost
下载Ghost:
curl -L https://github.com/TryGhost/Ghost/releases/download/0.11.8/Ghost-0.11.8.zip -o ghost.zip
解压缩Ghost:
unzip -uo ghost.zip -d /var/www/ghost
rm -f ghost.zip
导航到webroot:
cd /var/www/ghost
更改webroot目录的所有权:
chown -R ghost:ghost .
切换到新的幽灵用户:
su - ghost
导航到webroot:
cd /var/www/ghost
安装Ghost:
npm install --production
通过更改文件内部对象的属性url和mail属性来配置Ghost :productionconfig.js
cp config.example.js config.js
vi config.js
var path = require('path'),
config;
config = {
// ### Production
// When running Ghost in the wild, use the production environment.
// Configure your URL and mail settings here
production: {
url: 'https://example.com',
mail: {
options: {
service: '',
auth: {
user: '',
pass: ''
}
}
},
. . .
. . .
},
}
. . .
. . .
注意:您
启动Ghost:
npm start --production
Ghost现在将运行。博客前端和管理界面均已通过HTTPS进行了安全保护,并且HTTP / 2也在正常工作。您可以打开浏览器并访问的网站https://example.com。不要忘记example.com用您的域名替换。
通过按CTRL+ 关闭Ghost进程,C然后从Ghost用户返回到root用户:
exit
如果您使用VPS关闭终端会话,那么您的博客也将关闭。这不好。为了避免这种情况,我们将使用PM2流程管理器。这将使我们的博客保持24/7全天候运行。
安装最新的稳定版PM2流程管理器:
npm install -g pm2@latest
检查PM2版本:
pm2 -v
# 2.4.6
再次切换到幽灵用户:
su - ghost
将NODE_ENV环境变量设置为生产:
echo "export NODE_ENV=production" >> ~/.bashrc && source ~/.bashrc
使用PM2启动(守护)Ghost应用程序:
pm2 start /var/www/ghost/index.js --name "Ghost Blog"
导航到https://example.com/ghost/并创建Ghost管理员用户。尽快执行此操作。
而已。我们现在有一个功能齐全的Ghost博客。如果要将默认的名为Casper的 Ghost主题更改为自定义主题,只需下载该主题并将其解压缩到/var/www/ghost/content/themes文件夹中,然后通过位于的Ghost管理界面将其选中即可https://example.com/ghost。
在Arch Linux上使用Makepkg可以避免系统污染,确保仅安装必要的依赖关系。
快速学习如何在Ubuntu 16.04上安装OpenSIPS控制面板,为VoIP提供商提供支持的功能。
学习如何在Fedora 28上安装Akaunting,一款适合小型企业和自由职业者的开源会计软件。
使用其他系统?Mailtrain是一个基于Node.js和MySQL / MariaDB构建的开源自托管新闻通讯应用程序。
了解導致Minecraft延遲的原因和解決方案,包括優化伺服器性能和減少滯後的步驟。
勒索軟件攻擊呈上升趨勢,但人工智能能否幫助應對最新的計算機病毒?AI 是答案嗎?在這裡閱讀知道是 AI 布恩還是禍根
ReactOS,一個開源和免費的操作系統,這裡有最新版本。它能否滿足現代 Windows 用戶的需求並打倒微軟?讓我們更多地了解這種老式但更新的操作系統體驗。
Whatsapp 終於為 Mac 和 Windows 用戶推出了桌面應用程序。現在您可以輕鬆地從 Windows 或 Mac 訪問 Whatsapp。適用於 Windows 8+ 和 Mac OS 10.9+
閱讀本文以了解人工智能如何在小型公司中變得流行,以及它如何增加使它們成長並為競爭對手提供優勢的可能性。
最近,Apple 發布了 macOS Catalina 10.15.4 補充更新以修復問題,但似乎該更新引起了更多問題,導致 mac 機器變磚。閱讀這篇文章以了解更多信息