Install and deploy Nginx tutorial in Linux environment

1. Installation Tutorial

1. Official website download address: nginx: download

2. Download the tutorial:

1) Select the Stable version to download to the local (this version is the Linux version), after the download is complete, directly decompress it locally and put it into the linux system

2) Use the command to download in the linux environment:

Before downloading:

(1) Install dependent packages: yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel 

(2) Create a storage directory and download and decompress the installation package:

  Switch directory: cd /usr/local

  Create a new folder: mkdir nginx

  Switch to the nginx directory: cd nginx

Download the nginx installation package:

   wget http://nginx.org/download/nginx-1.22.0.tar.gz

   tar -xvf nginx-1.22.0.tar.gz

3. After the download is complete, install Nginx:

Switch to the newly created nginx directory: cd /usr/local/nginx

Enter the nginx directory: cd nginx-1.22.0

Execute the make command: make

Execute the installation command: make install

Check whether the installation is successful: ps -ef | grep nginx (see if there is an nginx process)

If the installation is successful, the nginx process will appear:

 4. After the installation is successful, start the Nginx service: Go to the /usr/local/nginx/sbin directory and start the service: ./nginx -c /usr/local/nginx/conf/nginx.conf

5. After the startup is successful, check the process again:

2. Deploy Nginx tutorial in linux environment

1. Configure the nginx.conf file:

   1) Open the configuration file: vi /usr/local/nginx/conf/nginx.conf

   Note: If root has a file directory, write the file directory (for example: /data/apps/html/frontend), if not, use the default html

   2) Or pull down the nginx.conf file, modify it locally and then upload it

2. Upload the dist file after packaging yourself

3. Restart nginx: ./nginx -c /usr/local/nginx/conf/nginx.conf

      Check whether nginx is started again: ps -ef | grep nginx 

4. After restarting, you can see the interface

 

Guess you like

Origin blog.csdn.net/m0_50298323/article/details/127075217