How to install, start, restart and stop Nginx under Linux

王林
Release: 2023-05-19 13:28:57
forward
1286 people have browsed it

What is Nginx? How to restart/stop Nginx in Linux system? In response to the above problems, the following article will explain to you what Nginx is specifically, as well as the installation/start/restart/stop of Nginx under Linux.

What is Nginx?

Nginx is a lightweight web server/reverse proxy server and email proxy server, and is released under a BSD-like protocol. It was developed by Russian programmer lgor Sysoev and is used by Rambler, a large Russian portal website and search engine. It is characterized by occupying less memory and strong concurrency capability. In fact, nginx's concurrency capability does perform better among web servers of the same type.

Compared with Apache\lighttpd, Nginx has the advantages of less memory and high stability. It is also famous for its strong concurrency capabilities, rich module library and friendly and flexible configuration.

Under the Linux operating system, nginx uses the epoll event model. Thanks to this, nginx is quite efficient under the Linux operating system. . At the same time, Nginx uses an efficient event model kqueue similar to Epoll on the OpenBSD or FreeBSD operating system.

Installation process

The installation process requires familiarity with the Linux network and the knowledge of configuring yum sources

Download it and transfer it to the server. The first step is to decompress

tar -zxvf nginx-1.13.1.tar.gz

How to install, start, restart and stop Nginx under Linux

Enter the directory of nginx-1.13.1 and view The following file

How to install, start, restart and stop Nginx under Linux

found that nginx is released through the source package, and nginx is written in C, so a c/c compiler needs to be installed

yum install gcc

How to install, start, restart and stop Nginx under Linux

How to install, start, restart and stop Nginx under Linux## As above, gcc has been installed, let’s install nginx

How to install, start, restart and stop Nginx under Linux

How to install, start, restart and stop Nginx under LinuxAt the end of the detection, it was found that the dependent pcre library was not available. Let’s install pcre

https://ftp.pcre.org/pub/pcre/

After downloading pcre, you will also need to decompress the tar.gz file first.

tar -zxvf pcre-8.00.tar.gz

How to install, start, restart and stop Nginx under LinuxAfter decompression, there are the following files, which are still source code installations

How to install, start, restart and stop Nginx under Linux

How to install, start, restart and stop Nginx under Linux

How to install, start, restart and stop Nginx under Linux

##It says that we can't find g, let's install g How to install, start, restart and stop Nginx under Linux

yum install gcc-c

Come back and continue to install pcreHow to install, start, restart and stop Nginx under Linux

./configure

make install

pcre installation is complete, go back and install nginxHow to install, start, restart and stop Nginx under Linux

Zlib is missing, we need Install zlib againHow to install, start, restart and stop Nginx under Linux

http://www.zlib.net/

zlib is also managed by tar.gz, unzip it first

I found that zlib is also managed by the source code package, to install zlibHow to install, start, restart and stop Nginx under Linux

./configure

make install

After the installation is completed, install nginx

./configure

make install

This time the installation was finally successful. The software is installed to

/usr/local/nginx

Start nginx

./usr/local/nginx/sbin/nginx

Access nginx( The ip address is: 192.168.100.100, the port number is: 80)

http://192.168.100.100:8080/

nginx is installed successfully.

How to install, start, restart and stop Nginx under Linux

Nginx stop and restart commands

Stop nginx

nginx -s stop

Restart nginx

nginx -s reload

What is a Linux system

Linux is a UNIX-like operating system that is free to use and spread freely. It is a POSIX-based multi-user, multi-tasking, multi-threading and A multi-CPU operating system that uses Linux to run major Unix tool software, applications, and network protocols.

The above is the detailed content of How to install, start, restart and stop Nginx under Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template