• Mode of nginx has three versions, the detail can visit before I write this blog, https://blog.csdn.net/qq_41684621/article/details/101900843
  • I installed the latest stable version of nginx1.161, which is the latest stable version so far
  • Before the installation, there are a lot of tutorials on the Internet to introduce the installation of Nginx, but they are too cumbersome, not suitable for the beginning of the small white to install, the following is my summary of the installation tutorial.
  • Install some dependencies before installing NGINX
Yum -y install GCC gcc-C ++ yum -y install GCC gcc-C ++ autoconf automake make // yum -y install pcr-devel install GCC gcc-C ++ autoconf automake make // yum -y install pcr-devel openssl-devel
  • Wget: /usr/local/
Wget HTTP: / / http://nginx.org/download/nginx-1.16.1.tar.gz
  • Unzip the downloaded installation package
The tar - ZXVF nginx - 1.16.1. Tar. Gz
  • Go to the unziplied nginx directory — “nginx-1.16.1”, compile and install
./configure --prefix=/usr/local/nginx
make && make install
  • Nginx’s startup directory should now appear
  • Enter the nginx directory, start nginx, the following are the common commands
./nginx // start./ nginx-s stop // stop./ nginx-s reload // reload
  • The installation was successful:

Here are two quick ways to start nginx. Instead of going to /usr/local/nginx/sbin, you can run nginx from any directory you like

  1. /usr/local/bin /usr/local/bin /usr/local/bin /usr/local/bin /usr/local/bin The specific usage is: ln -s source file object file.
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin

/usr/local/sbin = /usr/local/sbin



If you don’t want to use soft connections, you can also delete them. Correct way to delete (remove soft links, but not the actual data)

Rm-rf [soft link address]

In the above directive, the soft link address must not contain a “/” at the end. When it contains a “/”, the resource in the target directory of the soft link is deleted, not the soft link itself.

  1. NGINX will be permanently added to the system environment variable. PHP and MySQL methods are the same as this configuration, which is to configure XXX_HOME and PATH. Next, configure the environment variable by adding /etc/profile:
export NGINX_HOME=/usr/local/nginx
export PATH=$PATH:$NGINX_HOME/sbin

After saving and exiting, execute source /etc/profile to make the configuration file take effect.

Here’s the test:nginx -v



At this point, the environment variables can be configured to start, stop, or reconfigure NGINX in any directory. /

Nginx-s reload nginx-s reload nginx-s reload nginx-s reload

The nginx detailed installation steps, you can visit: https://www.nginx.cn/install