454luikty 发表于 2017-8-21 12:50:38

centos7.2下部署nginx

#nginx是一款功能强大、开源软件


1、系统版本和内核版本

         # uname -r
            3.10.0-327.el7.x86_64
         # cat /etc/redhat-release
            CentOS Linux release 7.2.1511 (Core)
         #

2、软件包版本nginx-1.11.10.tar.gz   (包的地址在介绍里)

3、安装依赖
         #yum install -y gccpcre-developenssl-devel
4、创建nginx启动用户、需要的目录并解压安装包。
         # useradd nginx
         # mkdir -p /usr、local/nginx/{client,proxy,fastcgi,uwsgi,scgi}
         # tar zxf nginx-1.11.10.tar.gz
         # cd nginx-1.11.10/
5、配置nginx的安装参数和编译

# ./configure \
--prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_flv_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--http-client-body-temp-path=/usr/local/nginx/client \
--http-proxy-temp-path=/usr/local/nginx/proxy \
--http-fastcgi-temp-path=/usr/local/nginx/fastcgi \
--http-uwsgi-temp-path=/usr/local/nginx/uwsgi \
--http-scgi-temp-path=/usr/local/nginx/scgi \
--with-pcre \
--with-file-aio \
--with-http_secure_link_module

# make && make install

6、验证安装是否成功
   #cd /usr/local/nginx/
       #ls sbin/
      nginx         证明安装成功
7、启动nginx并设置开机自启

   # /usr/local/nginx/sbin/nginx
   #vim /etc/rc.d/rc.local
   /usr/local/nginx/sbin/nginx
   # chmod a+x /etc/rc.d/rc.local   -------> centos7.2需要这一步
8、验证nginx是否正常启动

   打开网页输入       http://<ip地址>
   能看到nginx提供的页面表示安装成功





页: [1]
查看完整版本: centos7.2下部署nginx