Front-end deployment consists of the following steps
- Download and install the VIRTUAL machine (VMware)
1.1 IP addr(Querying the VM IP Address) 1.2 vi /etc/sysconfig/network-scripts/ifcfg-ens33(Connecting to the network) 1.3 /etc/init.d/network restartCopy the code
- Install the operating system software
Xshell 6(https://www.netsarang.com/zh/downloading)
Xftp 6(https://www.netsarang.com/zh/downloading)
Copy the code
- Install dependent packages
3.1 $yum install GCC -c++ 3.2 $yum install pcre pcre-devel 3.3 $yum -y install zlib zlib-devel 3.4 $yum -y install Openssl openssl-devel 3.5 $yum install nginx 3.6 $wget (nginx-1.170) failed!! $yum install wgetCopy the code
- Unzip the package
$tar - ZXVF nginx - 1.17.0. Tar. GzCopy the code
- Go to the decompressed package and compile the appropriate configure file
5.1 cd/ Return to root (cd. Going back up the directory,cd~ Back to user home directory) 5.2cd5.4. /configure Compile 5.5 make 5.6 make installCopy the code
- Configuring the Firewall
$firewall-cmd --zone=public --add-port=80/ TCP --permanent $firewall-cmd --zone=public --add-port=80/ TCP --permanentCopy the code
$firewall-cmd --zone=public --add-port=80/udp --permanent $firewall-cmd --zone=public --add-port=80/udp --permanentCopy the code
Note: If the firewall is not configured and restarted, port 80 cannot be seen.
- Restarting the Firewall
$firewall-cmd --reload or (systemctl stop firewalld.service --> systemctl start firewalld.service)Copy the code
- /usr/local/nginx/conf
$vim nginx.conf(1. Yum search vim; 2.yum install vim-enhanced -y)Copy the code
- /nginx -s reload(or./nginx starts)
NPM run build generates a dist folder and copies all contents of this folder to /usr/local/nginx/html
11. Use the VM IP address in the browser to view the project content (deployment complete).
Add one-click deployment
1. Cp the entire project code file to the root directory folder MNT 2. Linux Binaries (x64) 3. Wget (node.js) 4. Tar -zxvf package 5. 6../configure 7. Make 8. NPM run build 12.cp -r/MNT /trunk/dist/* /usr/local/nginx/html
Copy the code
One-click deployment: Put the command lines 10,11, and 12 in a file ending in xxx.shcd /mnt/trunk;
npm install;
npm run build;
cp -r /mnt/trunk/dist/* /usr/local/nginx/html;
Copy the code
Run the following code: dos2UNIX xxx.sh chmod 700 xxx.sh./xxx.shCopy the code
Nginx common instructions
Nginx start nginx-sReload restarts nginx-sStop stop ps - ef | grep nginx see if nginx process run netstat unltp | grep nginx view nginx port listening situation view version nginx nginx - v - t check nginx configuration file Nginx -h Displays help information. Nginx -v Displays detailed version information, including compilation parameters. Nginx -c filename Specifies the nginx configuration file-sThe quit outCopy the code