Skip to content

ward快速开始

说明

在Debain12下测试使用成功,其他发行版及系统仅供参考。

下载

下载链接

shell
wget https://github.com/AntonyLeons/Ward/releases/download/2.5.2/ward-2.5.2.jar

安装及配置

shell
sudo cp ward-2.5.2.jar /usr/local/etc/ward/ward.jar
sudo vim /usr/local/etc/ward/setup.ini

写入

ini
[setup]
# 网站标题
serverName = Nard
# 主题颜色:light or dark
theme = light
# 端口
port = 8200
enableFog = true
backgroundColor = #303030

如果未安装java需安装java

shell
sudo apt install default-jdk

设为系统服务

shell
sudo vim /etc/systemd/system/ward.service

写入

shell
[Unit]
Description=Ward
After=network.target

[Service]
Type=simple
Restart=on-failure
RestartSec=60s
ExecStart=java -jar /usr/local/etc/ward/ward.jar
WorkingDirectory=/usr/local/etc/ward

[Install]
WantedBy=multi-user.target

设为开机启动并立刻运行

shell
sudo systemctl enable --now ward.service

nginx配置

shell
sudo vim /etc/nignx/conf.d/ward.conf

写入

nginx
server{
    listen 80;
    # 将test.com替换为自己的域名
    server_name test.com;
    rewrite ^(.*) https://$server_name$1 permanent;
}

server{
    listen 443 ssl;
    # 将test.com替换为自己的域名
    server_name test.com;

    # 将/etc/nginx/conf.d/cert/test.pem替换为自己的公钥路径
    ssl_certificate '/etc/nginx/conf.d/cert/test.pem';
    # 将/etc/nginx/conf.d/cert/test.key替换为自己的私钥路径
    ssl_certificate_key '/etc/nginx/conf.d/cert/test.key';
    ssl_session_timeout 5m;
    ssl_protocols   TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
    ssl_prefer_server_ciphers on;

    location / {
        # 将8200替换为自己实际使用的端口
        proxy_pass http://localhost:8200/;
        proxy_set_header Host $http_host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection upgrade;
        proxy_set_header Accept-Encoding gzip;
    }

    error_page  404 /404.html;
}

重启nginx使配置生效

shell
sudo systemctl restart nginx.service

最后更新于:

未经许可禁止任何形式的转载