当前位置: 首页 > article >正文

打包部署若依(RuoYi)SpringBoot后端和Vue前端图文教程

打包后端‘

1,打开若依,点击右侧的Maven展开Maven管理,选择ruoyi>Lifecycle 先双击clean清除原本启动项目时生成的文件。然后点击package等待项目打包,切记要取消运行再打包

打包完成后会在ruoyi-admin>src>target里面看到.jar后缀的文件,就代表打包成功(可以把这个文件复制出来存放到其他地方,方便后面启动)

2,这个就是打包出来的文件

假如没成功,可以试试点这两个再清除一下

3,新建一个文件夹,把这个包丢进去

打开cmd

java -jar ruoyi-admin.jar

要保证端口没有被占用

前端使用

npm run build:prod

打包出来的文件

nginx

1,

2,把前端的dist打包文件放进去

3,运行(1)

4,启动(2)

启动

start nginx

重新启动

nginx -s reload

关闭nginx 

nginx -s stop


强制关闭

taskkill taskkill /f /t /im nginx.exe

nginx配置

listen 填前端要运行的端口, 你想用什么端口就用什么端口,不一定和开发时候的端口一样

listen       8085;

tip:nginx配置好,前端访问就要用配置好的这个端口访问
这里要填你后端的端口
proxy_pass http://127.0.0.1:8025/;

nginx访问页面

ip+ nginx配置的前端端口


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       8085;
        server_name  localhost;
        root html//dist;
        # root C://nginx//nginx-1.26.1//html//dist;
        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location /{
			try_files $uri $uri/ /index.html;
            index  index.html index.htm;
			autoindex on; 
        }

        location /prod-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;
			proxy_pass http://127.0.0.1:8025/;
		}

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}


http://www.kler.cn/news/310015.html

相关文章:

  • pycv实时目标检测快速实现
  • 120页ppt丨集团公司战略规划内容、方法、步骤及战略规划案例研究
  • 分类预测|基于粒子群优化径向基神经网络的数据分类预测Matlab程序PSO-RBF 多特征输入多类别输出 含基础RBF程序
  • 【鸿蒙】HarmonyOS NEXT星河入门到实战8-自定义组件-组件通信
  • 江科大笔记—STM32课程简介
  • 基于SpringBoot+Vue+MySQL的家乡特色推荐系统
  • 英飞凌—TC377芯片详解(1)
  • npm包管理工具
  • UGit:腾讯自研的Git客户端新宠
  • Spring如何处理线程并发问题?
  • 传输层协议 —— UDP协议
  • LXDE lxpanel桌面环境中打开一个终端窗口 lxterminal
  • PHP 中传值与传引用的区别
  • 线程有哪几种状态?
  • web杂项
  • 腾讯云技术深度探索:构建高效云原生微服务架构
  • Java Stream API | Java Stream API 中 `filter()`的使用
  • TCP/IP Socket用于测试免费使用的服务器端
  • window下idea中scala的配置
  • web基础—dvwa靶场(五)File Upload
  • HarmonyOS开发之自定义构建函数
  • gi清除无用缓存
  • 【Elasticsearch系列】Elasticsearch中的分页
  • Python用TOPSIS熵权法重构粮食系统及期刊指标权重多属性决策MCDM研究|附数据代码
  • 利用物化视图刷新同步表记录(2-rowid)
  • 828华为云征文|Flexus云服务器X实例部署宝塔运维面板
  • 大数据处理技术:分布式文件系统HDFS
  • 基础漏洞——SQL注入原理和利用
  • 职业院校数据科学与大数据技术专业人工智能实训室建设方案
  • 【Linux篇】TCP/IP协议(笔记)