CentOs6.5下配置nginx相關教程

來源:互聯網
上載者:User

下載最新版本Nginx 網址http://nginx.org/en/download.html


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


解壓下載下好的源碼包
tar -zxvf nginx-0.8.53.tar.gz


進入解壓出的源碼檔案夾
cd nginx-0.8.53


配置nginx
./configure --prefix=/opt/nginx --with-http_stub_status_module
解釋: --prefix 為安裝路徑,--with-為需要安裝的模組,具體可以運行./configure --help 查看有效模組


編譯並安裝 nginx
make && make install
-------------------------------------
安裝提示:
./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庫
可以從下面下載,我一開始下載了一個,不過還是不行,後來下一個版本高的,就可以了!
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/


解壓下載下好的源碼包
tar -zxvf pcre-8.34.tar.gz


進入解壓出的源碼檔案夾
cd pcre-8.34


執行:
./configure
make
make install


-------------------------------------


啟動 nginx
/opt/nginx/sbin/nginx


-------------------------------------
提示:
/opt/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory


解決方案:
ldd /opt/nginx/sbin/nginx =====>查看連結庫是否正常
linux-vdso.so.1 => (0x00007fff25dff000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f549c495000)
libpcre.so.1 => not found ======>沒找到對應庫
libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00007f549c0b4000)
libz.so.1 => /lib64/libz.so.1 (0x00007f549be9e000)
libc.so.6 => /lib64/libc.so.6 (0x00007f549bb0a000)
libfreebl3.so => /lib64/libfreebl3.so (0x00007f549b892000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f549b68e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f549c6d2000)



ln -s libpcre.so.0.0.1 libpcre.so.1
-------------------------------------


再次啟動 nginx
/opt/nginx/sbin/nginx


查看nginx是否正常啟動
ps -ef |grep nginx

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.