centos7.x安装nginx
安装依赖库
yum install -y zlib-devel openssl-devel pcre-devel
编译安装nginx1.12.x
wget http://nginx.org/download/nginx-1.12.1.tar.gz
tar zxf nginx-1.12.1.tar.gz
cd nginx-1.12.1
./configure --prefix=/usr/local/nginx \
--user=nginx --group=nginx \
--with-compat --with-file-aio --with-threads \
--with-http_addition_module \
--with-http_auth_request_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_mp4_module \
--with-http_random_index_module \
--with-http_realip_module \
--with-http_secure_link_module \
--with-http_slice_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_v2_module \
--with-mail --with-mail_ssl_module \
--with-stream --with-stream_realip_module \
--with-stream_ssl_module --with-stream_ssl_preread_module
make && make install
官网rpm包
导入rpm的key
wget http://nginx.org/keys/nginx_signing.key -O /tmp
rpm --import /tmp/nginx_signing.key
导入yum源
cat >> /etc/yum.repos.d/nginx.repo << EOF
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
EOF
安装nginx
yum install -y nginx
网友评论