Install Nginx and related environment configuration under Linux

Preface

 Nginx is a lightweight web server/reverse proxy server and email (IMAP/POP3) proxy server, issued under the BSD-like protocol. Its characteristic is that it occupies less memory and has strong concurrency

Official website  http://nginx.org/en/download.html

 

installation steps

1. Install dependent libraries

yum -y install gcc pcre-devel zlib-devel openssl openssl-devel

2. Download the source code

cd /usr/local
wget http://nginx.org/download/nginx-1.18.0.tar.gz

 3. Unzip the source code

tar -zxvf  nginx-1.18.0.tar.gz 

4. Configuration

cd nginx-1.18.0/
./configure --prefix=/usr/local/nginx

5. Compile

make
make install

6. Configure environment variables

vi /etc/profile

  Press i in English input state to enter insert mode, add the following configuration

export NGINX_HOME=/usr/local/nginx
export PATH=$NGINX_HOME/sbin:$PATH

  Press esc to enter  : wq to  save and exit, compile /etc/profile to make the configuration effective

source /etc/profile

7. Start nginx

nginx

7. Stop/restart (extended)

nginx -s stop
nginx -s reload

Guess you like

Origin blog.csdn.net/javanbme/article/details/112685913