Nginx deploys the front-end dist folder
Nginx deploys dist package_Mohan ice's blog-CSDN blog_nginx dist
nginx server deployment dist folder - Cainiao Academy (noobyard.com)
nginx deployment dist file - Lazy ing - 博客园 (cnblogs.com)
1. Download the compressed package (tar.gz) of Nginx
1. Download and upload nginx locally: download
2.wget command downloadwget -c https://nginx.org/download/nginx-1.20.1.tar.gz
2. Configure the environment required to install Nginx
yum -y install gcc gcc-c++ autoconf automake make
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
3. Unzip Nginx
tar -zxvf nginx-1.20.1.tar.gz
Linux modify file name
mv 原文件名 新文件名
If you need to rename, please pay attention to whether the folder name generated by the subsequent installation of Nginx conflicts to avoid file overwriting
Enter the unzipped file directory
Use the default configuration, then press Enter./configure
4. Compile and install Nginx
Enter in the current directory make
to compile
make
Note: Then press Enter, if there is a compilation error, please check whether the previous environment installation is all right
Install
make install
After the installation is successful, return to the previous directory at this time, and you will find that there are more nginx directories
5. Start Nginx
Go to the directory nginx
under the newly generated directorysbin
./nginx -t #检查配置文件是否正确无误,成功提示如下:
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
Start Nginx
./nginx
6. Copy the dist package to the specified directory (flexible modification according to the configuration file)
Put the dist folder nginx
inside the html
directory
7. Modify the configuration file nginx.conf
enter the folder nginx
underconf
vim nginx.conf
After saving the configuration file, you need to restart linux
./nginx -s reload
Other common commands
shutting down Nginx ./nginx -s quit
or./nginx -s stop
restart nginx./nginx -s reload
View nginx processps aux|grep nginx
Set up autostart
edit rc.local
file
vim /etc/rc.local
Then add at the bottom /usr/local/nginx/sbin/nginx
, :wq
save and exit