1 Nginx install the required system resources
Requirements are as follows:
2 Nginx download
wget 下载链接
3 Nginx installation
3.1 windows installation
3.2 linux installation
Source compiler installed by the way.
tar zxvf nginx.XX.tar.gz
cd nginx.XX
./configure
make
make install
The default installation directory: / use / local / nginx
3.3 supports HTTPS
Nginx source into the root directory, i.e. /opt/nginx-1.15.0/ under
the following command:
./configure --prefix=/usr/local/nginx–with-http_stub_status_module --with-http_ssl_module --with-file-aio --with-http_realip_module
Then run the command make to compile
Note: do not use make install command here, otherwise it will cover the installation.
Then the newly generated nginx nginx program overwrites the original program (/ usr / local / nginx / sbin / nginx), nginx should be closed at this time.
Check the new nginx program correctly:
/usr/local/nginx/sbin/nginx -t
View openssl module is added successfully:
/usr/local/nginx/sbin/nginx -V
If successful, it configure behind arguments is not empty.
configure script supports the option (to name a few focus):
./configure --prefix=路径 指定nginx的安装路径
./configure --sbin-path=路径 指定nginx可执行文件的安装路径
./configure --conf-path=路径 指定nginx的配置文件路径
./configure --error-log-path=路径 指定nginx的错误日志安装路径
3.4 start and restart
./nginx
./nginx -s stop
./nginx -s quit
./nginx -s reload
4 Nginx start, stop and restart smooth
Start:
Stop:
第一种:
ps -ef | grep nginx
然后kill掉
第二种:
./nginx -s stop
GR:
第一种:
ps -ef | grep nginx
kill -HUP Nginx进程号
第二种:
./nginx -s reload
5 Nginx control signal
6 Nginx of upgrade
Upgrades include: add or remove server modules. For example, to add support https tripartite module.
Proceed as follows:
1 add-party modules, recompile the executable file .nginx, and then use the new version replaces the old version, the old version of the attention backup.
2 sends the following command:
kill -USR2 旧版本的进程号
3 Restart the new executable file.
4 The old and the new version will also provide services to confirm the new version is correct, gracefully shut down the old version process.
kill -WINCH 旧版本的进程号
5 At this time, when the old process their requests have been processed, they will withdraw only handled by the new process.
6 At this time we can choose to adopt the new version or an older version.