nginx安装

  • 安装prce(重定向支持)和openssl(https支持,如果不需要https可以不安装。)
1
2
yum -y install pcre* 
yum -y install openssl*
  • 安装gcc
    yum install gcc

  • 安装c++
    yum -y install gcc-c++

  • 下载nginx 1.7.8

    1
    wget http://nginx.org/download/nginx-1.7.8.tar.gz 
  • 解压

1
tar -zxvf nginx-1.7.8.tar.gz
  • 然后进入目录编译安装

    1
    cd nginx-1.7.8
  • 构建

1
./configure --prefix=/usr/nginx --with-http_stub_status_module
1
2
3
./configure --prefix=/usr/nginx \
--with-http_ssl_module --with-http_spdy_module \
--with-http_stub_status_module --with-pcre
  • 如果没有error信息,就可以执行下边的安装了:

    1
    make && make install
  • 开启nginx进程

    1
    /usr/local/nginx/sbin/nginx 
  • 重启或关闭进程:

    1
    2
    /usr/local/nginx/sbin/nginx -s reload
    /usr/local/nginx/sbin/nginx -s stop

nginx安装
https://www.wekri.com/nginx/nginxInstallation/
Author
Echo
Posted on
June 6, 2018
Licensed under