linux centos7環境下安裝nginx的步驟詳解
1、 首先到nginx官網下載nginx安裝包
下載好後會見到類似下面的一份檔案
建立nginx-src目錄並且去到nginx-src目錄裡執行以下指令即可:
mkdir nginx-src && cd nginx-src
當然也可以在linux底下執行以下指令進行下載nginx安裝包
wget http://nginx.org/download/nginx-1.5.9.tar.gz
2、解壓縮nginx-1.5.9.tar.gz檔案
tar -zxvf nginx-1.5.9.tar.gz
3、刪除安裝包檔案指令
rm -f nginx-1.5.9.tar.gz
4、設定安裝執行指令
cd nginx-1.5.9/ ./configure --prefix=/usr/local/nginx
也許是提示缺包:
./configure: error: the http rewrite module requires the pcre library.
you can either disable the module by using --without-http_rewrite_module
option,
#option,或 install the pcre library into the system, or build the pcre librarystatically from the source with nginx by using --with-pcre=98953a78f52873edae60a617ec082494 option.
##安裝安裝安裝pcre-devel解決問題(需要有網路下運行並且是超級管理員身份)
yum -y install pcre-devel yum -y install openssl openssl-devel
要切換為root超級管理員身份: su
如果重新配置也不成功這時需要安裝gcc
yum –y install gcc
安裝好gcc之後再進行設定
##5 、編譯指令
make
6、安裝指令
make install
以上是Linux centos7環境下如何安裝Nginx的詳細內容。更多資訊請關注PHP中文網其他相關文章!