React 部署 centOS 前後端代碼筆記

//上傳jar 到服務器指定目錄

scp -P 22 /Users/arjun/IdeaProjects/performance/target/performance-1.0.0.jar [email protected]:/home/arjun/server

輸入密碼後回車,顯示文件上傳進度

//連接服務器

ssh -t [email protected] -p 22 

輸入密碼:

服務器安裝JDK:

yum install java-1.8.0-openjdk

cd /usr/lib/jvm

ll  //java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64

#設置JAVA環境變量

AVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64

JRE_HOME=$JAVA_HOME/jre

CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib

PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

export JAVA_HOME JRE_HOME CLASS_PATH PATH

進入項目目錄, 打包項目

mvn package

//項目打包jar後, 啓動jar

查看是否啓動進程

ps -ef|grep performance

如果已啓動 kill 掉進程 . 

啓動命令:


nohup java -jar performance-1.0.0.jar --spring.profiles.active=dev > performance.file 2>&1 &

  //上傳前端build 的代碼 目錄

scp -r /Users/arjun/web/PerformanceWeb/build/ [email protected]:/home/arjun/web

//服務器安裝nginx

yum install -y nginx

查看nginx 是否啓動

ps -ef|grep nginx

重啓Nginx服務

service nginx restart 或

nginx -s reload

  配置nginx , 

cd /etc/nginx/nginx.conf

加入配置

server {

        listen 9955;

        server_name localhost;

        root /home/arjun/web/build;

        index index.html index.htm;

        location / {

                try_files $uri $uri/ /index.html;

        }

        location ^~ /assets/ {

                gzip_static on;

                expires max;

                add_header Cache-Control public;

        }

       #gzip  on;

       #gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;

        location ~ /\.ht {
            deny  all;

        }



        location ~* \/jwt\/ {

           # rewrite '^.+jwt/?(.*)$' /$1 break;

            include uwsgi_params;

            proxy_pass http://112.126.72.99:8765;

        }

        location ~* \/performance\/ {

            rewrite '^.+performance/?(.*)$' /$1 break;

            include uwsgi_params;
            #proxy_pass http://112.126.72.99:1128;
            proxy_pass http://localhost:1128;

       }

        error_page 500 502 503 504 /500.html;

        client_max_body_size 20M;

        keepalive_timeout 10;


}​

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章