一、 What's Nginx?
Nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server.
二、How to install?
准备工作:
- 系统:ubuntu16.04 server
- 网络:畅通
- 方式:通过deb包安装
- 其他Linux平台安装方式参考:install nginx
安装过程(本教程是root用户执行命令,其他用户需在各个命令前加 sudo)
wget -c https://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
echo 'deb http://nginx.org/packages/ubuntu/ xenial nginx' >> /etc/apt/sources.list
echo 'deb-src http://nginx.org/packages/ubuntu/ xenial nginx' >> /etc/apt/sources.list
apt update
apt install nginx
nginx # 启动nginx
三、How to use Nginx?
nginx -s signal
Where signal may be one of the following:
- stop — fast shutdown
- quit — graceful shutdown
- reload — reloading the configuration file
- reopen — reopening the log files
For Example:
nginx -s quit
nginx -s reload
nginx -s restart
if the master process ID is 1628, to send the QUIT signal resulting in nginx’s graceful shutdown, execute:
kill -s QUIT 1628
For getting the list of all running nginx processes, the ps utility may be used, for example, in the following way:
ps -ax | grep nginx