阿里云-脚本部署Springboot博客

阿里云-脚本部署Springboot博客


1、写个nginx’反向代理的配置

server {
		listen       80;
        server_name  39.106.70.48;

        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        location / {
			proxy_pass http://39.106.70.48:8080;
			proxy_connect_timeout 600;
			proxy_read_timeout 600;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

2、打jar包发送到linux服务器上,创建个文件夹安排下它


3、写个shell脚本,startup.sh

JAVA_HOME=/usr/java/jdk1.8.0_221-amd64
CLASSPATH=%JAVA_HOME%/lib:%JAVA_HOME%/jre/lib
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
export PATH CLASSPATH JAVA_HOME

nohup java -jar /a-blog/blog.jar > /a-blog/out.log 2>1&
chmod 777 /a-blog/out.log

然后把写的脚本也一起放在文件夹里

  • 之后cd到这个文件夹
sudo sh  startup.sh 

你可能感兴趣的:(springboot)