Nginx deploys the front-end dist folder

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

image-20221218175731546

Linux modify file namemv 原文件名 新文件名

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

image-20221218180123984

Use the default configuration, then press Enter./configure

4. Compile and install Nginx

Enter in the current directory maketo 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

Note: "make[1]: Leaving directory `/usr/local/nginx' appears when compiling and installing nginx source code". The solution is make[1]

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 nginxunder 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 nginxinside the htmldirectory

image-20221218182536899

7. Modify the configuration file nginx.conf

enter the folder nginxunderconf

vim nginx.conf

image-20221218183109276

After saving the configuration file, you need to restart linux

./nginx -s reload

Other common commands

shutting down Nginx ./nginx -s quitor./nginx -s stop

restart nginx./nginx -s reload

View nginx processps aux|grep nginx

Set up autostart

edit rc.localfile

vim /etc/rc.local

Then add at the bottom /usr/local/nginx/sbin/nginx, :wqsave and exit

Guess you like

Origin blog.csdn.net/m0_60789072/article/details/128792963