Nginx的各種報錯總結


1、Nginx安裝過程報錯

錯誤一:軟件依賴包未正確安裝問題---PCRE依賴包沒有安裝

      ./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.

解決方法:yum install pcre pcre-devel -y

錯誤二:軟件依賴包未正確安裝問題---OPENSSL依賴包沒有安裝

 ./configure: error: SSL modules require the OpenSSL library.
 You can either do not enable the modules, or install the OpenSSL library
 into the system, or build the OpenSSL library statically from the source
 with nginx by using --with-openssl=<path> option.

解決方法:yum install openssl openssl-devel -y

錯誤三:編譯安裝pcre編譯軟件時,gcc不全導致報錯(使用yum安裝不存在此問題)。

報錯信息如下:
[root@gjlin2 pcre-8.30]# make && make install
make all-am
make[l]: Entering directory 7h〇me/gjlin/tools/pcre-8.30*
CXX pcrecpp.lo
libtool: compile : unrecognized option '-DHAVE_CONFIG_H'
libtool:compile : Try 'libtool --help' for more information.
make[l]:***[pcrecpp.lo]錯誤 1
make[l]:Leaving directory '/home/gjlin/tools/pcre-8.30'
make : *** [all]錯誤 2

解答:執行"yum -y install gcc-c++"命令安裝gcc-c++依賴包。

2、Nginx啟動過程中報錯

錯誤一:nginx軟件重復啟動產生的錯誤信息

[root@web01 nginx-1.10.2]# /application/nginx/sbin/nginx 
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

解決方法:nginx軟件已經啟動無需反復啟動,如果需要重新啟動需要停止nginx進程或者用reload方式進行重啟

錯誤二:403報錯

  •  服務阻止客戶端訪問
  •  服務端站點目錄中,沒有指定首頁文件信息  

錯誤三:啟動 Nginx 時如下報錯"nginx:[emerg]getpwnam(“nginx”)failed"

解答:這是因為沒有對應的Nginx服務用戶,執行useradd nginx -s /sbin/nologin -M創建Nginx用戶即可。為了讓讀者理解問題,重現上述錯誤過程,命令如下:

[root@web tools]# pkill nginx

[root@web tools]# userdel nginx

[root@web tools]# /application/nginx/sbin/nginx

nginx: [emerg] getpwnam(Mnginx") failed

[root@web tools]# useradd nginx -s /sbin/nologin -M

[root@web tools]# /application/nginx/sbin/nginx

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM