To deploy the code, you need to connect to the server first. You need to download xshell software, use the server account password to connect to the server, and then start configuring the nginx configuration. Let’s take a look at the nginx configuration command line:

Have no legal power into the folder operation can get super authority: execute the command sudo su nginx nginx configuration file. The conf path: / usr/local/nginx/conf/nginx. Conf by vim editor to edit the configuration file: vim nginx.conf server { listen 8093; Server_name localhost; Localhost #root /home/flatform/dist/; // you can omit #index index.html index.htm; // you can omit #charset koi8-r; #access_log logs/host.access.log main; /home/flatform/dist; // The root /home/flatform/dist file is displayed in /home/flatform/dist. // Index index.html index.htm; try_files $uri $uri/ /index.html; // The history route must be added with the add_header access-control-allow-origin *; } location/API / {// Same as the local project code configuration, use/API/to proxy cross-domain proxy_pass http://10.10.208.83:8093; Rewrite/API (.*) $1 break; }} after configured to determine whether a port number occupied: sudo netstat anp | grep port inspection nginx configuration is normal, whether the nginx run successful: /usr/local/nginx/sbin /usr/local/nginx/sbin Run CD /usr/local/nginx/sbin and run start nginx to restart nginx: run CD /usr/local/nginx/sbin and run./nginx -s reloadCopy the code

1. Connect to the server. Connect to the server through xshell software and know the account and password of the server. I created a flatform folder under /home. I created a flatform folder by using the command “mkdir + folder name” of Nginx. I stored the compressed front-end code here and decompressed it. So I the front page of the root of the root directory path is/home/flatform/dist/index. The HTML. After storing the front-end code, you can configure nginx, and then start or restart nginx to access. Into nginx nginx configuration file. The conf, path: / usr/local/nginx/conf/nginx. Conf, through the vim editor to edit the configuration file: vim nginx. Conf. You can add a new port number to listen on, or modify the previous port number:

server { listen 8093; Server_name localhost; Localhost #root /home/flatform/dist/; // you can omit #index index.html index.htm; // you can omit #charset koi8-r; #access_log logs/host.access.log main; /home/flatform/dist; // The root /home/flatform/dist file is displayed in /home/flatform/dist. // Index index.html index.htm; try_files $uri $uri/ /index.html; // The history route must be added with the add_header access-control-allow-origin *; } location/API / {// Same as the local project code configuration, use/API/to proxy cross-domain proxy_pass http://10.10.208.83:8093; Rewrite/API (.*) $1 break; }}Copy the code

Try_files $uri $uri/ /index.html; Nginx also needs to add the corresponding proxy, such as/API /; 4. Check whether the port number is occupied after the configuration is complete, check whether the port number is occupied. Sudo netstat anp | grep port number 5, check whether the nginx configuration is normal, whether the nginx run successfully into nginx folder first CD/usr/local/nginx/sbin. Then execute./nginx -t; Run nginx successfully if OK and SUCCESS are present. Run the /usr/local/nginx/sbin directory to restart nginx. Then execute./nginx -s reload. 7, in the browser to access the browser enter your server address and port number return can, my current is http://10.10.220.147:8089

Nginx common commands

Zip Upload command: rz Download command: sz + file name create folder command: mkdir + file name create file command: touch + file name delete file command: rm -f + file name delete folder command: Rm -rf + File name Obtain the absolute file path command: PWD View the version information command: --version Change the file name: mv xx YY jar Start: Nohup Java - jar ROOT. Jar > the out 2 > &1 & check the Java process: ps - ef | grep JavaCopy the code