- 一、pom文件配置
<packaging>jar</packaging>
- 配置可执行jar包的maven插件
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!-- 如果有依赖外部jar,则必须加上此配置includeSystemScope-->
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
- maven打包上传服务器后使用nohup java -jar后台执行
nohup java -jar test.jar &>>log.out &
- 配置Nginx映射端口等信息如下:
server {
listen 80;
charset utf-8;
server_name xx.xxx.cn; #你的域名
location /
{
proxy_set_header Host $host;
proxy_set_header X-Real-Ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://127.0.0.1:8080;
}
}