centos下安装nginx

本人qq群也有许多的技术文档,但愿能够为你提供一些帮助(非技术的勿加)。

QQ群:   281442983 (点击连接加入群:http://jq.qq.com/?_wv=1027&k=29LoD19)    QQ:1542385235html

一、到 http://nginx.org/en/download.html 下载稳定版(Stable version)。nginx

wget http://nginx.org/download/nginx-1.8.1.tar.gz

二、解压进入目录bash

1
2
tar zxvf nginx-1.8.1.tar.gz
cd nginx-1.8.1

三、 执行 configureui

./configure

报错:spa

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

安装 PCRE:code

1
yum -y install pcre-devel

再次执行 configurehtm

报错:blog

1
2
3
4
. /configure : error: the HTTP  gzip  module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or  install  the zlib library into the system, or build the zlib library
statically from the  source  with nginx by using --with-zlib=<path> option.

 安装zlib-devel:进程

1
yum -y  install  zlib-devel

 再次执行 configureip

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Configuration summary
   + using system PCRE library
   + OpenSSL library is not used
   + using  builtin  md5 code
   + sha1 library is not found
   + using system zlib library
 
   nginx path prefix:  "/usr/local/nginx"
   nginx binary  file "/usr/local/nginx/sbin/nginx"
   nginx configuration prefix:  "/usr/local/nginx/conf"
   nginx configuration  file "/usr/local/nginx/conf/nginx.conf"
   nginx pid  file "/usr/local/nginx/logs/nginx.pid"
   nginx error log  file "/usr/local/nginx/logs/error.log"
   nginx http access log  file "/usr/local/nginx/logs/access.log"
   nginx http client request body temporary files:  "client_body_temp"
   nginx http proxy temporary files:  "proxy_temp"
   nginx http fastcgi temporary files:  "fastcgi_temp"
   nginx http uwsgi temporary files:  "uwsgi_temp"
   nginx http scgi temporary files:  "scgi_temp"

提示 OpenSSL、sha1没有找到。

安装 openssl:

1
yum -y  install  openssl openssl-devel

找到openssl安装路径

1
whereis  openssl

再次执行 configure

1
. /configure  --with-openssl= /usr/include/openssl/

结果:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Configuration summary
   + using system PCRE library
   + using OpenSSL library:  /usr/include/openssl/
   + md5: using system crypto library
   + sha1: using system crypto library
   + using system zlib library
 
   nginx path prefix:  "/usr/local/nginx"
   nginx binary  file "/usr/local/nginx/sbin/nginx"
   nginx configuration prefix:  "/usr/local/nginx/conf"
   nginx configuration  file "/usr/local/nginx/conf/nginx.conf"
   nginx pid  file "/usr/local/nginx/logs/nginx.pid"
   nginx error log  file "/usr/local/nginx/logs/error.log"
   nginx http access log  file "/usr/local/nginx/logs/access.log"
   nginx http client request body temporary files:  "client_body_temp"
   nginx http proxy temporary files:  "proxy_temp"
   nginx http fastcgi temporary files:  "fastcgi_temp"
   nginx http uwsgi temporary files:  "uwsgi_temp"
   nginx http scgi temporary files:  "scgi_temp"

四、编译,安装。

1
make  &&  make  install

 五、启动

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

 六、查看进程是否启动

1
ps  -ef |  grep  nginx

 结果:

1
2
3
root     11548     1  0 12:34 ?        00:00:00 nginx: master process  /usr/local/nginx/sbin/nginx  -c  /usr/local/nginx/conf/nginx .conf
nobody   11549 11548  0 12:34 ?        00:00:00 nginx: worker process                                         
root     11572 11558  0 12:36 pts /1     00:00:00  grep  nginx

 七、其它

nginx中文手册

本人qq群也有许多的技术文档,但愿能够为你提供一些帮助(非技术的勿加)。

QQ群:   281442983 (点击连接加入群:http://jq.qq.com/?_wv=1027&k=29LoD19)    QQ:1542385235

 

个人淘宝店,能够进去逛逛噢:https://shop108912636.taobao.com/index.htm?spm=2013.1.w5001-7867000954.3.1d29318dPlLar7&scene=taobao_shop

相关文章
相关标签/搜索