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

How to start nginx in Linux system

PHPz
PHPzforward
2023-05-16 15:33:5643500browse

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

How to start nginx in Linux system

  • Quick stop

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 -TERM 2132
 
 或 [root@LinuxServer ~]# kill -INT 2132

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!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete