小强

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

类似问卷星的开源项目Tduck填鸭部署到Linux服务器

 1.去gitee上把前后端代码下载到本地。

后端源码:https://gitee.com/TDuckApp/tduck-platform
前端源码:https://gitee.com/TDuckApp/tduck-front

2.使用idea打开tduck-platform后端代码,双击package打包生成tduck-api.jar包。

 3.使用WinSCP把jar包放到服务器指定目录/home/software/tduck-platform

 4.使用java命令运行springboot项目

nohup java -Dfile.encoding=UTF-8 -jar tduck-api.jar & --后台运行
java -jar /home/software/tduck-platform/tduck-api.jar --测试用的

5.前端项目打包

npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install 
cnpm run build

6.使用WinSCP把项目放到服务器的nginx下面,并解压缩

cd /usr/local/nginx/html
unzip -o tduck.zip -d /usr/local/nginx/html

7.修改nginx配置文件,启动nginx

worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;

       location / {
          # 静态文件地址
            root   /usr/local/nginx/html/tduck;
	    try_files $uri $uri/ /index.html;
            index  index.html index.htm;
        }
		
	location /tduck-api/{
	    proxy_set_header Host $http_host;
	    proxy_set_header X-Real-IP $remote_addr;
	    proxy_set_header REMOTE-HOST $remote_addr;
	    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	    # 改为你后端接口地址   http://xxxx/tduck-api/
	    proxy_pass http://localhost:8999/tduck-api/;
	}

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}
systemctl start nginx --启动   
systemctl stop nginx --关闭
ps -ef|grep tduck-api.jar --获取进程号
kill 进程号

posted on   搬砖狗-小强  阅读(618)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示