Linux install nginx web server

Nginx is a lightweight web server/reverse proxy server and email (IMAP/POP3) proxy server, under the BSD-like protocol issued. Its characteristics are that it occupies less memory and has strong concurrency capabilities. In fact, nginx’s concurrency capabilities perform better in the same type of web server. Mainland Chinese users of nginx websites include: Baidu, JD, Sina, NetEase, Tencent, Taobao, etc.</ p>

1. Installing Nginx depends on the necessary environment

Nginx generally requires prec, zlib, openssl secure socket layer cryptographic library

On centos:

# On the centos machine
yum install -y openssl openssl-devel zlib zlib-devel pcre pcre-devel

On ubuntu:

# On the Ubuntu machine
apt-get install openssl openssl-devel zlib zlib-devel pcre pcre-devel

2. Download source code resources

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

# Download with wget command
wget -bc -t 20 http://nginx.org/download/nginx-1.16.1.tar.gz

Local download: nginx-1.16.1

# Download with wget command
wget -bc -t 20 https://www.ivdone.top/wordpress/pic/p680/nginx-1.16.1.tar.gz

3. Unzip

# Unzip with the tar command
tar -zxvf nginx-1.16.1.tar.gz
# Enter the directory
cd nginx-1.16.1/

4. Installation

If your computer needs to be configured with an ssl certificate, to prevent the following errors:

nginx: [emerg] unknown directive “ssl” in xxx

Add the enable ssl module in configure

# Use the configure script to detect the system environment and enable the ssl module
./configure --prefix=/usr/local/nginx --with-http_ssl_module

Detection environment interface:

make tool compilation and installation:

# make tool compilation and installation
make
make install

Installation interface:

make interface:


make install interface:

5. Test

# Enter the installation directory
cd /usr/local/nginx/

nginx version test:

# Check version
/usr/local/nginx/sbin/nginx -v

Congratulations on completing the installation, please edit the configuration file to deploy your application!

0

Leave a Reply

Your email address will not be published.