Software Installation

There are many ways to install the same software. In Linux, there are several common ways to install the software:

  1. Source code compilation and installation: generally need to decompress and then use make, make install and other commands, this way steps are more complex, compilation time is long, and the result is not controllable
  2. RedHat Package Manager (RPM) is a software management Package. It is easy to install and uninstall, but cannot resolve the dependency between software packages
  3. YUM (Yellow Dog Updater, Modified) is an RPM front-end that automatically resolves software dependencies. Be aware of versioning issues, however, as the default installation from the repository may not be the latest version
  4. Do not need to install as long as the configuration of environment variables (unzip can be used)

Installation steps

1, download

Address from nginx.org/en/download… Copy download address

The mkdir nginx wget HTTP: / / http://nginx.org/download/nginx-1.18.0.tar.gzCopy the code

2, decompression

The tar - XZVF nginx - 1.18.0. Tar. GzCopy the code

3. Installation depends on the environment

  • GCC environment: The basic running environment
  • Pcre: The HTTP module for Nginx parses regular expressions
  • Zlib: The user performs gzip compression
  • Openssl: used for nginx HTTPS transmission
yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
Copy the code

4. Compile and install

— prefix=/jackxu/nginx/nginx =/jackxu/nginx/nginx =/jackxu/nginx/nginx /nginx =/jackxu/nginx/nginx /nginx =/jackxu/nginx/nginx

/configure --prefix=/jackxu/nginx/nginx /nginx Make && sudo make install # CD /jackxu/nginx/nginxCopy the code

Test whether the configuration is successful

/jackxu/nginx/nginx/sbin/nginx -t -c /jackxu/nginx/nginx/conf/nginx.conf
Copy the code

Test success

5. Start Nginx

/jackxu/nginx/nginx/sbin/nginx
Copy the code

6, access,

Browser directly access IP (HTTP protocol default port 80, do not need to enter: port)

7, copy vimfile

In order for VIM to view nginx configuration files with syntax highlighting, the corresponding files need to be copied to the VIM directory. Only the nginx.conf file is highlighted.

CD /jackxu/nginx/nginx-1.18.0 copy cp -r contrib/vim/* /usr/share/vim/vimfiles/Copy the code

8. Common commands

Nginx -s reload # reopen nginx; Nginx -s stop # stop the Nginx service Nginx -s quit # Stop the Nginx service Nginx -t Then exit nginx -? Nginx -v # display version information and exit nginx -v # display version information and exit nginx -t # check whether the configuration file has syntax errors. Nginx -p prefix # Set the prefix path (default :/usr/share/nginx/) nginx -c filename Nginx -g directives # set global directives outside the configuration file killall nginx # killall nginx processesCopy the code