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				# 停止

CentOS7安装Nginx-1.6.2_第1张图片

你可能感兴趣的:(Nginx)