nginx源码安装脚本
#!/bin/bash
id nginx &>/dev/null
if [ $? -ne 0 ];then
useradd -s /sbin/nologin nginx
fi
yum -y install gcc pcre-devel openssl-devel zlib-devel wget &>/dev/null
cd /usr/local/src
wget http://nginx.org/download/nginx-1.18.0.tar.gz &>/dev/null
tar -zxvf nginx-1.18.0.tar.gz
cd nginx-1.18.0
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_gzip_static_module &>/dev/null
make && make install &>/dev/null
nginx常用命令
格式:nginx -s reload
使用指定的配置文件:-c
指定配置指令:-g
指定运行目录:-p
发送信号:-s
测试配置文件是否有语法错误:-t -T
打印nginx的版本信息、编译信息等:-v -V
立刻停止服务:stop
优雅的停止服务:quit
重载配置文件:reload
重新开始记录日志文件:reopen