首页 > 技术文章 > 部署springboot时出现的问题

CoderWangEx 2021-07-25 13:35 原文

一、打包出现问题

后经发现是因为maven的打包插件的版本问题,需要修改版本

<plugins>
    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
            <excludes>
                <exclude>
                    <groupId>org.projectlombok</groupId>
                    <artifactId>lombok</artifactId>
                </exclude>
            </excludes>
        </configuration>
    </plugin>
    <!--在这里修改版本-->
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.1.0</version>
    </plugin>
    <!---->
</plugins>

二、使用nohup后台

nohup java -jar *******.jar &

1、nohup: ignoring input and appending output to ‘nohup.out’

他的意思是,之后会直接忽略输入,并且会把输出(日志)写在nohup.out文件中

2、tail -f nohup.out

这个指令可以观看nohup.out文件具体内容

3、jobs -l

查看全部nuhup正在执行的任务

4、kill -9 任务对应号码

关闭任务

三、nginx负责的转发

了解:Nginx 实现端口转发 - 星河赵 - 博客园

#springboot测试均衡池
upstream boot_pool{
	# 注意这里要先开放8080端口
	server 101.34.51.129:8080;
}

server
    {
        listen 88;
        server_name coderwang.exploit365.cn;
        index index.html index.htm index.php;
        root  /www/server/phpmyadmin;
    #error_page   404   /404.html;
    include enable-php.conf;

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
    }

    location ~ .*\.(js|css)?$
    {
        expires      12h;
    }

    location ~ /\.
    {
        deny all;
    }

    access_log  /www/wwwlogs/access.log;
}

#Demo2端口转发
server {
	# 这个地方要监视80端口
    listen       80;
    server_name  coderwang.exploit365.cn;
    access_log logs/movie.log;
    error_log logs/movie.error;
    #将所有请求转发给demo_pool池的应用处理
	location / {
    	proxy_set_header Host $host;
    	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    	proxy_pass http://boot_pool;
	}
} 

推荐阅读