The article directories
- preface
- Install Nginx
- Vue project deployment
- The end of the
preface
Install Nginx
1. Download Nginx
Nginx.org/en/download…
2, upload
You can use the XShell+XFtp tool to upload to the /usr/local directory
Or download it directly
Wget -c https://nginx.org/download/nginx-1.12.0.tar.gzCopy the code
3, decompression
The tar - ZXVF nginx - 1.12.2. Tar. GzCopy the code
4. Install the dependency tools
yum install -y gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
Copy the code
5, configuration,
./configure
Copy the code
If the nginx directory is displayed in /usr/local, the installation is successful
make && make install
Copy the code
7. Use startup
cd /usr/local/nginx/sbin/
./nginx
Copy the code
Other commands
/nginx -s stop Stops./nginx -s quit Exits./nginx -s reload restartsCopy the code
8. Enable port 80
Firewall-cmd --zone=public --add-port=80/ TCP --permanent (--permanent takes effect permanently.Copy the code
Reload the
firewall-cmd --reload
Copy the code
Or turn off the firewall
systemctl stop firewalld
Copy the code
If Welcome to nginx! If yes, Nginx is running successfully.
Vue project deployment
1, Package Vue project in the front-end project directory, enter the package command:
npm run build
Copy the code
The project appears in the dist directory
2, upload
Zip the dist directory to /usr/local
3. Decompress Create a directory, move the package into it, and then decompress it
mkdir oa_web
mv dist.zip oa_web
unzip oa_web/dist.zip
Copy the code
4, Configure nginx modify the nginx.conf configuration file
vi nginx/conf/nginx.conf
Copy the code
Modify the configuration so that the root directory of nginx points to the project directory
5. Restart nginx
cd /usr/local/nginx/sbin
./nginx -s reload
Copy the code
Revisit http://localhost and the page is changed to the front page of the front-end project.