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

相關文章
相關標籤/搜索