Front and rear side deployment project vue

A front-end package

1. Local distal packing:  

npm run build

2. Generate a package directory dist

 

 

3. labeled zip package uploaded to the server

II. Deployed to nginx

1. Modify the nginx configuration file

vim /etc/nginx/nginx.conf 

2. The new server configuration items

{Server 
              the listen 8080 ; # 1 . Do you want your project to run the port in which 
              server_name 10.200.200.251 ; # 2 . The current server ip 
       LOCATION / { 
           root    / Home / dist /; # 3 position .dist file (I ) placed directly under the home directory 
            try_files $ $ URI URI / /index.html; # . 4 . redirection point internal file (as written) 
       } LOCATION
        / {# API . 4 . when requesting configuration port forwarding cross-domain
             proxy_pass HTTP: / / . 10.210.235.252:8848/api;}} # forwarding address. 5

Note: Fields marked in yellow are configured to forward to the back-end services, that is, when page views during http://168.0.0.1:8080/api , nginx will be forwarded to http://168.0.0.2:8848/api this address, that this back-end address.

III. Back-end configuration

1. In application.yml configuration file: By default, all api request must add a prefix / api to access to

#server配置
server:
  max-http-header-size: 4048576
#  servlet.context-path: /api
  port: 9848

2.springboot labeled jar package: mvn install -Dmaven.test.skip = true

3. put on the server 10.210.235.252

4. Start jar package:

nohup ${JAVA_HOME}/bin/java -jar tds.service.jar --spring.profiles.active=prod -Xmx2g -Xms2g -XX:PermSize=128m -XX:MaxPermSize=256m -XX:+DisableExplicitGC -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails -XX:+PrintTenuringDistribution -XX:+PrintGCTimeStamps -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs/dumps -jar $APP_NAME > /dev/null 2>&1 &

Above, to complete the deployment configuration front and rear ends

Guess you like

Origin www.cnblogs.com/zhulibin2012/p/12465903.html