打印/下载
Jar包
Nginx

pom.xml

<build>
  <plugins>
    <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
    </plugin>
  </plugins>
</build>

打包

mvn package
  • 打包文件在target目录下

发布

nohup java -jar xxx.jar >> log.txt &

#查看
ps -aux| grep java

开机启动

# 权限
chmod +x /etc/rc.d/rc.local
# 编辑文件
vi /etc/rc.d/rc.local

添加内容

cd /xxx/java/ && nohup java -jar xxx.jar &

demo.java.conf

upstream demo_java {
    server localhost:9000;
}

server {
    listen       80;
    server_name  demo-java.webmis.vip;
    set $root_path /xxx/java/;
    root $root_path;
    index index.html;

    charset utf-8;

    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://demo_java;
    }

    location ~* ^/(webmis|upload|themes|favicon.png)/(.+)$ {
        root $root_path;
    }

    location ~ /\.ht {
        deny  all;
    }
}
{{copy}}