Preparation before installation
yum install gcc-c++ yum install -y pcre pcre-devel yum install -y zlib zlib-devel yum install -y openssl openssl-devel
Download nginx and unzip it
Download address: https://nginx.org/download/nginx-1.10.2.tar.gz
-
tar -zxvf nginx-1.10.2.tar.gz
Use default configuration
cd /nginx-1.10.2 ./configure
Compile and install
make make install
Find the installation location
whereis nginx
Start and stop nginx
cd /usr/local/nginx/sbin/ ./nginx ./nginx -s stop ./nginx -s quit ./nginx -s reload ./nginx -s quit: The stopping step of this method is to stop the nginx process after the processing task is completed. ./nginx -s stop: This method is equivalent to first finding out the nginx process id and then using the kill command to forcibly kill the process.
Set up to start automatically vi /etc/rc.local add a line /usr/local/nginx/sbin/nginx chmod 755 rc.local