1. Download the nginx software source package
mkdir -p /home/tools ###Note that the downloaded path and the installed path cannot be the same, otherwise an error will occur
cd /home/data/tools
wget -q http://nginx.org/ download/nginx-1.18.0.tar.gz ##Copy the link address (download in a unified location)
2. Decompress the source package
(decompress the software --- configuration (./configure) --- compile make --- install make install
tar xf nginx-1.18.0.tar.gz
cd nginx-1.18.0
ls (contents inside It is the source code (config readme installation instructions) ---The default compilation will be installed to the /usr/local directory)
3. Create a web service user
useradd -s /sbin/nologin -M www
./configure --prefix=/application/nginx-1.18.0 --user=www --group=www --with-http_stub_status_module --with- http_ssl_module
--prefix=PATH specifies the installation path
--user=user specifies under what identity the software is started (owner operation)
--group=group specifies what identity (belongs to the group) after the software is started, the premise is the user Must exist.
--with-http_stub_status_module nginx activation status information
enter the nginx decompression directory configure --help view the parameters that can be used when installing nginx
ubuntu installation C dependencies
first need to install the build-essential package
1. View the package content
apt-cache depends build- essential
2. Install the software package
apt install build-essential
ubuntu install nginx dependent
PCRE library
apt install libpcre3 libpcre3-dev
zlib library
apt install zlib1g-dev
OpenSSL library
apt-get install openssl libssl-dev
4. Compile and install
cd /home/tools/nginx ##Enter the file to be compiled
make
make install
5. Create soft links for easy use
ln -s /apps/nginx-1.18.0 /apps/nginx
6. Turn nginx on and off
/apps/nginx/sbin/ -t
/apps/nginx/sbin/ #Start service
-s reload #Restart-
s stop #Stop the service