zoukankan      html  css  js  c++  java
  • springBoot多模块 jar部署到Linux系统使用Nginx*

    本人使用开发工具IDEA

    在本地运行均ok的话,检查配置文件如有本地绝对路径或者本地数据库连接

    均先改为服务器线上操作,本人项目后端访问地址增加了请求前缀来区分项目

     多项目打包

    在入口模块当中增加插件

                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>2.1.1.RELEASE</version>        

     打包工具在Maven

    在主模块下先clean

    然后再package

     然后找到你入口模块的文件夹target目录下的jar包即可上传部署

    首先上传到Linux目录下jar使用自带tomcat比较简单

    进入到上传的文件目录地址

    只需要运行

    nohup java -jar 你的文件名.jar > logs.log & 

    即可

    随后会产生一个进程

    查看进程 jps

    关闭进程kill -9 进程号

    nginx配置

    找到nginx.conf

    这里贴出server块

    server {
            listen       80;
            server_name  www.; //域名
            index index.html index.htm;
            
            location / {
                    root   /usr/local/server/war/portal;//vue绝对路径
                    index  index.html index.htm;
            }
            location /bi/ {
                    alias   /usr/local/server/war/ruoyi/;
                    index  index.html index.htm;
            }
        //springBoot代理
            location /prod-api {
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_pass http://ip地址:8090/prod-api;#注意加上请求前缀访问地址,与配置文件保持一致
            }
             
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
        }

    切记 代理端口与项目配置文件的端口号要一直 例如 :8090

    访问时 http://www.xxx.com/prod-api 即转发至hppt://服务器ip地址:8090/prod-api

    本人使用后端调试接口工具

    Postman

  • 相关阅读:
    基于Windows Mobile 5.0的GPS应用程序开发
    iis6应用程序池被自动禁用问题 应用程序池'DefaultAppPool' 被自动禁用
    Axapta物流模块深度历险(八)
    AX的报表服务器(一)
    AX的企业门户(一)
    SQL Server2005 Reporting Services 管理站点
    SQL Server2005 Reporting Services的卸载
    耐心的解决问题
    危险操作符
    慢慢的坚持啊
  • 原文地址:https://www.cnblogs.com/dzcici/p/13879617.html
Copyright © 2011-2022 走看看