天天看點

checking for OS + Linux 3.10.0-957.el7.x86_64 x86_64 checking for C compiler ... not found ./config

                                 解壓目錄執行編譯參數配置./configure --prefix=/usr/local/nginx

linux版本:CentOS7 64位

在安裝nginx前首先要确認系統中安裝了gcc、pcre-devel、zlib-devel、openssl-devel。

nginx下載下傳位址:https://nginx.org/download/

下載下傳“nginx-1.9.9.tar.gz”,移動到/usr/local/下。

## 解壓
tar -zxvf nginx-1.9.9.tar.gz

##移動
mv nginx-1.9.9 nginx

##進入nginx目錄
cd nginx

## 配置,這一步可能會出現各種的錯誤,在下面會一一列出。
./configure --prefix=/usr/local/nginx      

錯誤資訊:

checking for OS

+ Linux 3.10.0-327.el7.x86_64 x86_64

checking for C compiler ... not found

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

解決方法:安裝gcc

yum -y install gcc      

錯誤資訊:

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

解決方法:安裝pcre-devel

yum install pcre-devel      

錯誤資訊:

./configure: error: the HTTP gzip module requires the zlib library.

解決方法:安裝zlib-devel

yum install zlib-devel      

再次執行“./configure --prefix=/usr/local/nginx”

正确的結果如下:

checking for OS + Linux 3.10.0-957.el7.x86_64 x86_64 checking for C compiler ... not found ./config

OK,現在可以執行make 了。 如果你想使用openssl 功能,sha1 功能就需要安裝openssl ,sha1。

yum -y install openssl openssl-devel      

開啟ssl 子產品

./configure --with-http_ssl_module      
checking for OS + Linux 3.10.0-957.el7.x86_64 x86_64 checking for C compiler ... not found ./config

執行make、make install指令

測試是否安裝成功

./nginx -t      

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok

nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

啟動nginx 

cd /usr/local/nginx/sbin
./nginx //啟動nginx      

在浏覽器中輸入伺服器的ip位址,如:192.168.1.12

很不幸,打不開連結。下面進行原因排查:

checking for OS + Linux 3.10.0-957.el7.x86_64 x86_64 checking for C compiler ... not found ./config
checking for OS + Linux 3.10.0-957.el7.x86_64 x86_64 checking for C compiler ... not found ./config

說明伺服器的80端口是打不開的。

因為我使用的linux系統版本是CentOS7,是以可以在伺服器中執行如下指令來驗證》》

firewall-cmd --query-port=80/tcp      
checking for OS + Linux 3.10.0-957.el7.x86_64 x86_64 checking for C compiler ... not found ./config

顯然80端口沒有開啟。

下面我們開啟80端口:

checking for OS + Linux 3.10.0-957.el7.x86_64 x86_64 checking for C compiler ... not found ./config

重新整理浏覽器

checking for OS + Linux 3.10.0-957.el7.x86_64 x86_64 checking for C compiler ... not found ./config

====================== 分割線 ====================

配置完畢!

繼續閱讀