nginx离线部署

1、创建nginx专属用户

用户/用户组   www/www

创建用户组  groupadd www

创建用户  useradd www -g www -p neusoft

2、安装必要依赖

2.1 gcc安装

           进入Packages包内

   执行以下安装命令

           rpm -ivh kernel-headers-2.6.32-573.el6.x86_64.rpm

           rpm -ivh glibc-headers-2.12-1.166.e16.x86_64.rpm

           rpm -ivh glibc-devel-2.12-1.166.e16.x86_64.rpm

           rpm -ivh mpfr-2.4.1-6.e16.x86_64.rpm

           rpm -ivh ppl-0.10.2-11.e16.x86_64.rpm

           rpm -ivh cloog-ppl-0.15.7-1.2.e16.x86_64.rpm

           rpm -ivh cpp-4.4.7-16.e16.x86_64.rpm

           rpm -ivh libgomp-4.4.7-16.e16.x86_64.rpm

           rpm -ivh gcc-4.4.7-16.e16.x86_64.rpm

           rpm -ivh libstdc++-devel-4.4.7-16.e16.x86_64.rpm

           rpm -ivh gcc-c++-4.4.7-16.e16.x86_64.rpm

2.2 安装zlib

           rpm -ivh zlib-1.2.3-29.e16.x86_64.rpm

           rpm -ivh zlib-devel-1.2.3-29.e16.x86_64.rpm

2.3 安装openssl

   rpm -ivh openssl-1.0.1e-42.e16.x86_64.rpm

           rpm -ivh libcom_err-devel-1.41.12-22.e16.x86_64.rpm

           rpm -ivh libsepol-devel-2.0.41-4.e16.x64_64.rpm

           rpm -ivh libselinux-devel-2.0.94-5.8.e16.x86_64.rpm

           rpm -ivh keyutils-libs-devel-1.4-5.e16.x86_64.rpm

           rpm -ivh krb5-devel-1.10.3-42.e16.x86_64.rpm

   rpm -ivh openssl-devel-1.0.1e-42.e16.x86_64.rpm

2.4 安装pcre

   找到/opt/software/pcre-8.40.zip

   解压 

   执行如下命令:

./configure

                make

                make install

3、安装nginx

找到/opt/software/nginx-1.12.0.tar.gz

解压至相应目录

执行以下命令:

./configure \

--prefix=/usr/local/nginx \

--with-http_stub_status_module \

--with-http_ssl_module  \

--with-http_realip_module

make & make install

4、将相应的配置文件拷贝至/usr/local/nginx/conf目录下

/opt/conf/nginx.conf

/opt/conf/nginx_9093.conf

5、启动nginx

创建软连接: ln -s /usr/local/lib/libpcre.so.1 /lib64/

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx_9093.conf

6、关闭防火墙

service iptables stop

chkconfig iptables off

相关推荐