標籤:cep ddr efi ror 功能 eve centos int option
安裝步驟: 1、下載nginx,執行:wget http://nginx.org/download/nginx-1.10.2.tar.gz2、解壓,執行:tar vxzf nginx-1.10.2.tar.gz3、安裝,切換到nginx解壓目錄下,執行:./configure --prefix=/usr/local/nginx
遇到問題: 執行時報錯: checking for C compiler ... not found ./configure: error: C compiler cc is not found
原因:缺少編譯環境
解決: 安裝gcc,執行:yum install gcc 4、繼續執行:./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, 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.
原因:缺少rewrite模組,需要安裝PCRE library(即Regex)
解決: 安裝pcre library,執行:yum install pcre 安裝完成後再安裝pcre-devel(開發使用包):yum install pcre-devel 5、安裝完成後再次執行./configure --prefix=/usr/local/nginx6、安裝,執行:make && make install7、切換到/usr/local下發現有nginx目錄,安裝完成8、繼續切換到/usr/local/nginx下查看有目錄為:
....conf 設定檔
... html 網頁檔案
...logs 記錄檔
...sbin 主要二進位程式
9、啟動nginx,執行:./sbin/nginx
遇到問題: 啟動過程中可能出現:nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
原因:80連接埠被佔用
解決: 執行:netstat -antp(或netstat -tunlp) 查看佔用連接埠的程式,如: 殺掉進程即可,執行:kill -9 2985 //2985是進程號 10、再次啟動,執行:./sbin/nginx 啟動成功沒有任何提示
訪問:安裝成功後可通過虛擬機器ip直接存取主機,正常情況會出現nginx歡迎頁面,但是發現無法訪問,windows下ping主機ip可以ping通,但是執行:telnet ip 連接埠 無法訪問,說明可能是linux防火牆的問題 註:telnet開啟方法:控制台--->程式和功能--->開啟或關閉windows功能--->勾選Telnet伺服器及Telnet用戶端兩個選項,點擊確定--->在windows視窗下執行telnet嘗試即可然後依次執行以下操作允許80連接埠的訪問:1、 /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT 2、/etc/init.d/iptables save 3、 /etc/init.d/iptables restart 操作具體反映如下: 至此,再次訪問主機ip地址即可出現nginx歡迎頁面了,主機已可訪問虛擬機器的nginx服務。
centos上nginx的安裝