Linux:kkFileView v4.0.0 安装、启动教程(包含nginx的配置)
# 安装依赖
sudo apt-update
sudo apt install -y openjdk-11-jre-headless
# 下载kkFileView v4.0.0
wget https://github.com/kekingcn/file-online-preview/releases/download/4.0.0/kkFileView-4.0.0.zip
# 解压缩
unzip kkFileView-4.0.0.zip
# 配置nginx
sudo tee /etc/nginx/sites-available/kkfileview <<EOF
server {
listen 80;
server_name your_domain_or_IP;
location / {
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header Host \$http_host;
proxy_set_header X-Nginx-Proxy true;
proxy_set_header Connection "upgrade";
proxy_pass http://127.0.0.1:8012;
proxy_http_version 1.1;
proxy_cache_bypass \$http_upgrade;
}
}
EOF
# 创建软链接
sudo ln -s /etc/nginx/sites-available/kkfileview /etc/nginx/sites-enabled/
# 检查nginx配置并重启nginx
sudo nginx -t
sudo systemctl restart nginx
# 启动kkFileView
cd kkFileView-4.0.0
chmod +x bin/*.sh
./bin/start.sh
以上脚本提供了从下载、解压到配置nginx和启动kkFileView的完整流程。确保替换your_domain_or_IP
为你的域名或IP地址。在执行这些步骤之前,请确保你已经安装了unzip
和wget
。如果没有安装,可以通过执行sudo apt install unzip wget
来安装。
评论已关闭