编译安装
系统: Linux centos7 安装版本:nginx-1.16.1
1.下载nginx
[root@centos7_4 data]# cd /data/
[root@centos7_4 data]# wget http://nginx.org/download/nginx-1.16.1.tar.gz
[root@centos7_4 data]# tar xvf nginx-1.16.1.tar.gz
2.安装包:
[root@centos7_4 data]# yum install gcc pcre-devel openssl-devel zlib-devel -y
3.创建用户:
[root@centos7_4 data]# useradd -r -s /sbin/nologin nginx
4.编译:
[root@centos7_4 data]# cd nginx-1.16.1/
./configure --prefix=/apps/nginx \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-pcre \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module
5.安装:
[root@centos7_4 nginx-1.16.1]# lscpu
[root@centos7_4 nginx-1.16.1]# make -j 4 && make install
6.启动
[root@centos7_4 nginx-1.16.1]# /apps/nginx/sbin/nginx
创建软链接
[root@centos7_4 nginx-1.16.1]# ln -s /apps/nginx/sbin/nginx /usr/sbin/
启动:
[root@centos7_4 nginx-1.16.1]# nginx
7.设置开机启动
[root@centos7_4 nginx-1.16.1]# vim /etc/rc.d/rc.local
/usr/sbin/nginx
[root@centos7_4 nginx-1.16.1]# chmod +x /etc/rc.d/rc.local