1、在/home目录创建nginx/log和nginx/run目录;
2、将nginx-1.16.1.tar.gz上传到/usr/local/src;
3、tar -xzvf nginx-1.16.1.tar.gz 解压;
4、cd nginx-1.16.1 进入nginx-1.16.1目录;
5、 ./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/home/nginx/log/error.log --modules-path=/usr/lib64/nginx/modules --http-log-path=/home/nginx/log/access.log --pid-path=/home/nginx/run/nginx.pid --lock-path=/home/nginx/run/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_dav_module --with-http_stub_status_module --with-threads --with-file-aio; 将这段复制粘贴到命令行并回车;
6、如果有错误提示,可复制错误提示到百度搜索,一般都是缺少相关组件造成的,更新或安装一下即可;
7、make;
8、mage install;安装完成;
9、cd /usr/local/nginx/sbin;进入这个目录;
10、执行./nginx启动、./nginx -s stop等命令;
11、如果出现“nginx: [emerg] getpwnam(“nginx”) failed”,创建nginx用户即可;
12、useradd -s /sbin/nologin -M nginx;创建nginx用户;
13、id nginx;查看创建完成
centos编译安装nginx-1.16.1
最新推荐文章于 2021-01-17 18:52:59 发布