Linux下安裝與配置nginx

第一次發表內容,但願你們多多支持linux

1,下載文件就很少說了,從官方下載便可,這裏用的版本爲nginx-1.5.12,目前是最新版nginx

2,安裝時遇到了一些問題,須要安裝重寫依賴包等,以下所示,ui

解壓後運行./configure --prefix=/usr/local/environment/reverse-proxy/nginx --with-http_stub_status_module時報了以下錯誤:搜索引擎

./configure: error: the HTTP rewrite module requires the PCRE library.3d

You can either disable the module by using --without-http_rewrite_moduleblog

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.圖片

重寫依賴包未安裝,若是閒麻煩就直接yum安裝,不然本身去下載安裝,這裏我本身下載安裝的 it

可是安裝的時候仍是出錯了 configure: error: You need a C++ compiler for C++ support. 鬱悶的io

這裏遇到了一個小插曲,因防火牆的攔截全部yum源沒法使用,改了一下防火牆配置後OK了

以後就很好解決了 缺什麼依賴包就安裝什麼依賴包便可,yum這個東西很方便的,

3,啓動時杯具了,./nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

輸入:ldd which /usr/local/environment/reverse-proxy/nginx/sbin/nginx

which:

ldd: ./which: No such file or directory

/usr/local/environment/reverse-proxy/nginx/sbin/nginx:

        Linux-vdso.so.1 =>  (0x00007fff5977a000)

        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f5208a01000)

        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f52087ca000)

        libpcre.so.1 => not found

        libz.so.1 => /lib64/libz.so.1 (0x00007f52085b3000)

        libc.so.6 => /lib64/libc.so.6 (0x00007f5208220000)

        /lib64/ld-linux-x86-64.so.2 (0x00007f5208c23000)

        libfreebl3.so => /lib64/libfreebl3.so (0x00007f5207fbd000)

        libdl.so.2 => /lib64/libdl.so.2 (0x00007f5207db9000)

發現libpcre.so.1 => not found

那須要手動去連接

輸入:ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1 具體意思問搜索引擎

而後在啓動nginx大功告成

添加開機啓動項 :

chkconfig /usr/local/nginx/sbin/nginx 

遇到問題能夠加我扣扣交流1af20004b39c7a0c0104

請點擊此處輸入圖片描述

相關文章
相關標籤/搜索