1. 安装 .net运行时

首先下载纸壳cms所需的运行时:

wget -o dotnet.tar.gz http://www.zkea.net/dotnet-runtime-linux

  

然后将运行时提取到$home/dotnet目录:

mkdir -p "$home/dotnet" && tar zxf dotnet.tar.gz -c "$home/dotnet"

  

在安装完成运行时之后,还需要安装libicu-dev和libgdiplus:

apt update
apt install libicu-dev libgdiplus -y

  

2. 安装nginx

我们使用nginx来做反向代理,安装nginx很简单,在ssh端输入以下命令即可。

apt install nginx

  

安装完成以后,用服务器ip访问一下,如果可以正常访问,说明nginx已经正常运行了。

 

 

3. 配置nginx

需要要设置nginx反向代理到cms的本地监听端口,修改默认配置文件 /etc/nginx/sites-available/default

vi /etc/nginx/sites-available/default

  

使用以下内容替换原有内容(按键盘i或者insert开启编辑模式):

server {
    listen 80;
    location / {
        proxy_pass http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header upgrade $http_upgrade;
        proxy_set_header connection keep-alive;
        proxy_set_header host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

  

修改完成后,按esc键退出编辑模式,然后按组合键shift+:,然后输入wq,回车进行保存。

重启nginx

systemctl restart nginx

  

4. 安装zkeacms

使用wget命令下载cms程序

wget https://cloud.zkeasoft.com/file/zkeasoft/cms.zip

  

安装unzip命令,用于解压cms.zip:

apt install unzip -y

  

然后使用unzip命令将cms解压到/root/cms 目录下,使用以下命令解压

unzip cms.zip -d cms

  

 

 

5. 添加服务运行zkeacms

添加一个zkeacms服务

vi /etc/systemd/system/zkeacms.service

  

输入以下内容保存

[unit]
description=zkeacms

[service]
workingdirectory=/root/cms
execstart=/root/dotnet/dotnet zkeacms.webhost.dll
restart=always
restartsec=10
syslogidentifier=zkeacms
user=root
environment=aspnetcore_environment=production

[install]
wantedby=multi-user.target

  

注意:execstart=/root/dotnet/dotnet zkeacms.webhost.dll/root/dotnet/dotnet为dotnet程序的路径,即$home/dotnet/dotnet。具体路径与当前登录用户有关,可以使用以下命令查询安装路径:

printf "$home/dotnet/dotnet\n"

  

启动网站

systemctl start zkeacms

  

网站启动以后,就可以尝试使用域名或者ip进行访问了。

如果网站不能访问,可以先查询一下纸壳cms的运行状态是否正常:

systemctl status zkeacms

  

服务开机启动

设置服务开机启动,不然每一次重启服务器都要手动启动cms服务

systemctl enable zkeacms

   

常见问题

原文地址: