CentOS7安装Nginx-1.6.2

安装

Nginx下载
升级Nginx

useradd -s /sbin/nologin www
yum -y update					#更新系统软件
yum -y install pcre*			#安装使nginx支持rewrite
yum -y install gcc-c++
yum -y install zlib*
yum -y install openssl openssl-devel
wget http://nginx.org/download/nginx-1.6.2.tar.gz
tar -xf nginx-1.6.2.tar.gz
cd nginx-1.6.2/

进去后如果发现有configure这个文件,说明这个源码包安装前需要先进行配置,主要是为了检查当前的环境是否满足要安装软件的依赖关系,如果没有这个文件说明是二进制包,解压后直接使用不用configure
再次进行检查操作 ./configure 没发现报错显示,接下来进行编译并安装的操作

#检查模块支持
  ./configure  --prefix=/usr/local/nginx  --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-stream --with-stream_ssl_module --with-stream_realip_module --with-stream_ssl_preread_module --with-threads --user=www --group=www
#检查模块支持
./configure
> --prefix=/usr/local/nginx
> --with-http_ssl_module 
> --with-http_v2_module 
> --with-http_realip_module 
> --with-http_addition_module 
> --with-http_sub_module 
> --with-http_dav_module 
> --with-http_flv_module 
> --with-http_mp4_module 
> --with-http_gunzip_module 
> --with-http_gzip_static_module 
> --with-http_auth_request_module 
> --with-http_random_index_module 
> --with-http_secure_link_module 
> --with-http_degradation_module 
> --with-http_slice_module 
> --with-http_stub_status_module 
> --with-mail --with-mail_ssl_module 
> --with-stream 
> --with-stream_ssl_module 
> --with-stream_realip_module 
> --with-stream_ssl_preread_module 
> --with-threads 
> --user=www 
> --group=www
#编译并安装
make && make install
# 环境CentOS7
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --user=www --group=www
# 环境CentOS7
./configure  
> --prefix=/usr/local/nginx  
> --with-http_ssl_module 
> --with-http_realip_module 
> --with-http_addition_module 
> --with-http_sub_module 
> --with-http_dav_module 
> --with-http_flv_module 
> --with-http_mp4_module 
> --with-http_gunzip_module 
> --with-http_gzip_static_module 
> --with-http_auth_request_module 
> --with-http_random_index_module 
> --with-http_secure_link_module 
> --with-http_degradation_module 
> --with-http_stub_status_module 
> --with-mail --with-mail_ssl_module 
> --user=www 
> --group=www
make && make install
whereis nginx		# 查询
nginx: /usr/sbin/nginx /usr/local/nginx
ln -s /usr/local/nginx/sbin/nginx /sbin/				# 软连接
nginx						# 启动
ss -untlp | grep 80			# 端口
nginx -s reload				# 重新启动
nginx -s stop				# 停止

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值