1. 安装依赖包
yum install gcc gcc+
yum install -y pcre pcre-devel openssl openssl-devel zlib zlib-devel
2. 创建nginx用户
useradd -s /bin/false -M nginx
3. 下载包并安装
curl -LJO http://nginx.org/download/nginx-1.12.2.tar.gz
./configure --user=nginx --group=nginx --prefix=/data/nginx/ --with-http_v2_module --with-http_ssl_module --with-http_sub_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre
make && make install
4. 配置文件说明
user nginx nginx; 定义运行的用户和用户组
worker_processes 1;
error_log logs/error.log; 定义log存放路径
pid /var/run/nginx.pid 进程文件
worker_connections 1024; 最大并发连接数(总并发数=worker_processes * worker_connections)
参考链接:https://www.cnblogs.com/liang-wei/p/5849771.html