Home > Operation and Maintenance > Nginx > How to start nginx in Linux system

How to start nginx in Linux system

PHPz
Release: 2023-05-16 15:33:56
forward
43748 people have browsed it

How to start nginx in Linux system

Nginx introduction:

Nginx (engine x) is a high-performance HTTP and reverse proxy service. It has many very superior features: In the case of high concurrency of connections, Nginx is a good substitute for Apache service: Nginx is one of the software platforms often chosen by bosses in the virtual host business in the United States.

Linux system startup Nginx method:

Startup

Startup code format: nginx installation directory address -c nginx configuration file address

For example:

[root@LinuxServer sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

Stop

Stop nginx There are three ways:

Stop calmly

1. Check the process number

[root@LinuxServer ~]# ps -ef|grep nginx

How to start nginx in Linux system

2. Kill the process

 [root@LinuxServer ~]# kill -QUIT 2072
Copy after login

How to start nginx in Linux system

  • Quick stop

1. Check the process number

 [root@LinuxServer ~]# ps -ef|grep nginx
Copy after login

How to start nginx in Linux system

2. Kill the process

 [root@LinuxServer ~]# kill -TERM 2132
 
 或 [root@LinuxServer ~]# kill -INT 2132
Copy after login

How to start nginx in Linux system

Force stop

[root @LinuxServer ~]# pkill -9 nginx

Restart

1. Verify whether the nginx configuration file is correct

Method 1: Enter the nginx installation directory sbin and enter the command./ nginx -t

See the following display nginx.conf syntax is ok

nginx.conf test is successful

It means the configuration file is correct!

How to start nginx in Linux system

Method 2: Add -t before the startup command -c

2. Restart the Nginx service

Method 1: Enter nginx to Under the execution directory sbin, enter the command ./nginx -s reload to

How to start nginx in Linux system

Method 2: Find the current nginx process number, and then enter the command: kill -HUP process number to restart nginx service

How to start nginx in Linux system

The above is the detailed content of How to start nginx in Linux system. 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