Book Image

Nginx Essentials

By : Valery Kholodkov, Valery I Kholodkov
Book Image

Nginx Essentials

By: Valery Kholodkov, Valery I Kholodkov

Overview of this book

Table of Contents (13 chapters)

Starting and stopping Nginx


In the previous chapter, you learned a bit about how to start your Nginx instance. On Ubuntu, Debian, or Redhat-like systems you can run the following command:

# service nginx start

In the absence of startup scripts, you can simply run the binary using the following command:

# sbin/nginx

Nginx will read and parse the configuration file, create a PID file (a file containing its process ID), open log files, create listening sockets, and start worker processes. Once worker processes have started, a Nginx instance is able to respond to incoming connections. This is what a running Nginx instance looks like in the process list:

# ps -C nginx -f
UID        PID  PPID  C STIME TTY          TIME CMD
root      2324     1  0 15:30 ?        00:00:00 nginx: master process /usr/sbin/nginx
www-data  2325  2324  0 15:30 ?        00:00:00 nginx: worker process
www-data  2326  2324  0 15:30 ?        00:00:00 nginx: worker process
www-data  2327  2324  0 15:30 ?        00:00:00 nginx...