1. 程式人生 > >Nginx 安裝過程中遇到的一些問題及解決方法

Nginx 安裝過程中遇到的一些問題及解決方法

requires nbsp margin req 命令 裝包 ... check sbin

一、安裝

獲取安裝包:

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

技術分享

解壓安裝包:

tar -zxvf nginx-1.11.5.tar.gz

技術分享

切換到 nginx-1.11.5 目錄

技術分享

執行 ./configure

出現錯誤:

checking for C compiler ... not found

./configure: error: C compiler cc is not found

技術分享

原因:沒有安裝gcc

解決方法:使用root用戶 執行 yum install gcc

技術分享

安裝成功:

技術分享

再次執行 ./configure

出現錯誤:

./configure: error: the HTTP rewrite module requires the PCRE library.
技術分享

解決方法:

yum -y install pcre-devel

再次執行,出現錯誤

錯誤提示:./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library

解決方法:

yum -y install openssl openssl-devel

然後再執行 make &&make install

技術分享

二、啟動

nginx的啟動目錄在 /usr/local/nginx/sbin

直接進入該安裝目錄下,輸入命令 ./nginx -t 即可啟動

技術分享

也可以執行 ./nginx -s reload

進行重啟

配置文件的修改 也需在/usr/local/nginx 目錄下的conf中進行

技術分享

Nginx 安裝過程中遇到的一些問題及解決方法