Linux install Nginx 1.14.0

1, perform the following command to install nginx dependent libraries, if missing dependencies, installation might fail.

-Y-C the install GCC yum ++

yum the install PCRE PCRE -Y-devel

yum the install zlib zlib -Y-devel

yum the install OpenSSL OpenSSL-devel -Y


2, in the home directory download: CD / home

opened Nginx official website

Here Insert Picture Description

to download:

wget http://nginx.org/download/nginx-1.14.0.tar.gz

3. decompression: tar -zxvf nginx-1.14.0.tar.gz
cd nginx-1.14.0
detect the current system environment, to ensure a successful installation of nginx: ./configure
Here Insert Picture Description
continue with the following command:
the make
the make install

After installation, can cd / usr / local / to see whether there is nginx
Here Insert Picture Description
4, configure boot
switch to: cd / lib / systemd / System
created: vi nginx.service
add the following:

[Unit]
Description=nginx 
After=network.target 

[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx reload
ExecStop=/usr/local/nginx/sbin/nginx quit
PrivateTmp=true

[Install]
WantedBy=multi-user.target
执行:systemctl enable nginx.service

Commonly used commands:
systemctl Start nginx.service start nginx
systemctl STOP nginx.service end nginx
systemctl restart nginx.service restart nginx

5. Verify that the installation was successful, see Welcome to nginx! Says the installation was successful!
http: ip address
Here Insert Picture Description

Original: https://blog.csdn.net/qq_33554286/article/details/88358399

Guess you like

Origin blog.csdn.net/qq_41723615/article/details/93407806