nginx 1.10.0-安装

安装nginx 1.10.0

环境: centos 6.5 x86_64 mini版

#关闭防火墙和selinux
Service iptables stop
Setenforce 0

创建用户

[root@zabbix-server sbin]# useradd -M nginx -s /sbin/nologin

安装环境需要的包

如果yum 安装报错 :ERROR 404 类似错误,请更换源:

https://blog.wojc.cn/497.html

yum -y install ntp make openssl openssl-devel  libpng libpng-devel libjpeg libjpeg-devel freetype freetype-devel gd gd-devel  gcc gcc-c++ libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel libtool
wget  https://www.jinchuang.org/novel/lnmp/pcre-8.35.tar.gz
wget  https://www.openssl.org/source/openssl-1.0.2h.tar.gz
wget  https://www.jinchuang.org/novel/lnmp/zlib-1.2.8.tar.gz
wget  http://nginx.org/download/nginx-1.10.0.tar.gz

解压编译安装

tar xf pcre-8.35.tar.gz
cd pcre-8.38
./configure --prefix=/usr/local/pcre-8.35
make && make install

tar xf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --prefix=/usr/local/zlib-1.2.8
make && make install

tar xf openssl-1.0.2h.tar.gz
cd openssl-1.0.2h
./config --prefix=/usr/local/openssl-1.0.2h
make && make install

解压安装nginx包

tar -zxvf nginx-1.10.0.tar.gz
cd nginx-1.10.0

配置:【注意:pcre,openssl,zlib路径填写源码包路径不是编译安装后路径】

./configure \
--prefix=/usr/local/nginx \
--lock-path=/var/nginx/nginx.lock \
--user=nginx \
--group=nginx \
--with-stream \
--with-file-aio \
--with-poll_module \
--with-http_ssl_module \
--with-select_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_gunzip_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_image_filter_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-http_image_filter_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_stub_status_module \
--with-pcre=/source/pcre-8.35 \
--with-openssl=/source/openssl-1.0.2h \
--with-zlib=/source/zlib-1.2.8

编译 && 编译安装

make && make install

启动nginx

/usr/local/nginx/sbin/nginx

#做一个软连接,直接用nginx 命令就可以启动停止
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/

查看器启动状态

netstat -anpt  |grep 80

tcp    0      0 0.0.0.0:80         0.0.0.0:*        LISTEN      6217/nginx

访问测试

http://ip地址

 

 

 

 

分享