源码安装nginx

下载nginx源码 https://github.com/nginx/nginx

 

checkout到stable的tag上

 

安装 gcc gcc-c++ autoconf automake

yum -y install gcc gcc-c++ autoconf automake

 

安装需要的库

yum -y install openssl-devel zlib-devel pcre-devel

 

在源码目录下执行 ./auto/configuration

 

问题解决

1. no "events" section in configuration

增加到配置文件

events { worker_connections 1024; ## Default: 1024 }

 

2.getpwnam("nginx") failed

创建nginx用户 

useradd nginx -s /sbin/nologin -M

 

3. PID file /var/run/nginx.pid not readable (yet?) after start

配置文件里增加 

pid /run/nginx.pid;

posted @ 2021-02-08 16:58  xuchenCN  阅读(95)  评论(0编辑  收藏  举报