在Arch Linux上使用Makepkg
在Arch Linux上使用Makepkg可以避免系统污染,确保仅安装必要的依赖关系。
自2013年发布以来,Ghost是一个开源博客平台,在开发人员和普通用户中越来越受欢迎。它把重点放在内容和博客上。Ghost最吸引人的地方是其简单,干净且响应迅速的设计。您可以通过手机撰写博客文章。Ghost的内容是使用Markdown语言编写的。
在本指南中,我们将使用Let's Encrypt,Node.js和Nginx在Debian 8.7 VPS上设置和部署Ghost博客。
在开始此步骤之前,请确保已为您的域设置了DNS记录。
更新系统:
apt update && apt upgrade -y
安装所需的工具:
apt install -y zip build-essential
启用Jessie backports回购。运行apt edit-sources以下行并将其粘贴到/etc/apt/sources.list文件末尾:
# Copy/Paste the below line at the end of file
deb http://ftp.debian.org/debian jessie-backports main
刷新软件包来源:
apt update
安装Certbot(又名“让我们加密客户端”):
apt install -y certbot -t jessie-backports
检查版本:
certbot --version
# certbot 0.9.3
获得证书:
certbot certonly -d example.com -d www.example.com --email john.doe@mail.com --agree-tos --standalone
完成上述步骤后,您的证书和私钥将位于/etc/letsencrypt/live/example.com目录中。
幽灵目前支持节点版本0.12.x,4.2+和6.9+而已。
v4 argon LTS在撰写本文时,我们将为Ghost安装推荐的版本。
下载并安装LTS版本的Node.js:
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
apt install -y nodejs
检查节点和NPM版本:
node -v && npm -v
# v4.7.2
# 2.15.11
下载并安装Nginx:
apt install nginx -t jessie-backports
检查Nginx版本:
nginx -v
# nginx version: nginx/1.9.10
启动Nginx服务并检查状态:
systemctl start nginx
systemctl status nginx
将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 -t
重新加载Nginx:
systemctl reload nginx
如果要在同一VPS上托管多个Ghost博客,则每个Ghost实例必须在单独的端口上运行。
制作webroot目录:
mkdir -p /var/www/
创建一个Ghost用户:
adduser ghost
下载并安装Ghost:
cd /var/www
wget https://ghost.org/zip/ghost-latest.zip
unzip ghost-latest.zip -d ghost
chown -R ghost:ghost /var/www/ghost/
rm ghost-latest.zip
切换到ghost用户:
su - ghost
安装Ghost:
cd /var/www/ghost
npm install --production
通过更改文件内部对象的url属性来配置Ghost :productionconfig.js
cp config.example.js config.js
vi config.js
config = {
// ### Production
// When running Ghost in the wild, use the production environment.
// Configure your URL and mail settings here
production: {
url: 'https://example.com',
...
}
...
...
注意:您
保存config.js文件并退出。
启动Ghost:
npm start --production
Ghost现在正在您的服务器上运行。博客前端和管理界面均已通过HTTPS进行了安全保护,并且HTTP / 2也在正常工作。您可以打开浏览器并访问https://example.com。不要忘记example.com用您的域名替换。
如果您关闭了VPS的终端会话,那么您的博客也将关闭。这不好。为了避免这种情况,我们将使用Forever流程管理器。这样可以使您的博客保持24/7全天候运行。
切换到ghost用户:
su - ghost
转到/var/www/ghost文件夹:
cd /var/www/ghost
永久安装:
npm install forever
将新forever命令添加到您的路径:
echo "export PATH=/var/www/ghost/node_modules/forever/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
从永远开始Ghost:
NODE_ENV=production /var/www/ghost/node_modules/forever/bin/forever start index.js
此时,forever应该已经启动了Ghost。
转到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 機器變磚。閱讀這篇文章以了解更多信息