CentOS7服务去Nginx使用-安装

1、官网下载目前稳定版本nginx

  

  这里我使用1.12.1版本进行安装。

  上传到linux/mnt/pack/nginx这个目录,主要是存放linux安装相关的文件。

  可以使用window下载好上传到linux,或者直接在linux服务器下载。

 

2、安装gcc编译环境

  

3、安装pcre

  pcre(Perl Compatible Regular Expressions) 是一个Perl库,包括 perl 兼容的正则表达式库。nginx http 模块使用 pcre 来解析正则表达式,所以需要在 linux 上安装 pcre 库,pcre-devel 是使用 pcre 开发的一个二次开发库。nginx也需要此库。

  在/mnt/pack/nginx这个目录下载:

# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz

   

  解压并且安装:

  

# cd pcre-8.41/
# ./configure
# make
# make install

4、安装zlib

   zlib 库提供了很多种压缩和解压缩的方式, nginx 使用 zlib http 包的内容进行 gzip ,所以需要在Centos上安装 zlib库。

   /mnt/pack/nginx这个目录下载

# wget http://zlib.net/zlib-1.2.11.tar.gz

   

  解压并且安装:

# tar -zxvf zlib-1.2.11.tar.gz
# cd zlib-1.2.11/
# ./configure
# make
# make install

5、安装OpentSSL

  OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及 SSL 协议,并提供丰富的应用程序供测试或其它目的使用。

  nginx 不仅支持 http 协议,还支持 https(即在ssl协议上传输http),所以需要在 Centos 安装 OpenSSL 库。

  /mnt/pack/nginx这个目录下载:

# wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz

  

  解压并且安装:

# tar -zxvf openssl-1.0.2l.tar.gz
# cd openssl-1.0.2l/
# ./config
# make
# make install

6、安装nginx

   linux服务器中下载:

# wget http://nginx.org/download/nginx-1.12.1.tar.gz

 

  解压并且安装: 

# tar -zxvf nginx-1.12.1.tar.gz
# cd nginx-1.12.1/
# ./configure
# make
# make install

7nginx的启动与停止

# ./nginx
# ./nginx -s stop
# ./nginx -s quit
# ./nginx -s reload

8、启动后查看nginx是否启动

   

9、测试  

  配置默认是80端口

 

  查看nginx.conf配置情况

 

   

  

 

posted @ 2017-08-22 18:09  C小海  阅读(284)  评论(0编辑  收藏  举报