SpringBoot部署并配置Nginx步骤

  1. 一、pom文件配置
<packaging>jar</packaging>
  1. 配置可执行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>
  1. maven打包上传服务器后使用nohup java -jar后台执行
nohup java -jar test.jar &>>log.out &
  1. 配置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;
	}
}
posted @ 2023-07-19 00:45  加瓦同学  阅读(221)  评论(0编辑  收藏  举报