在linux(centos)系統安裝nginx教程

2022-02-10 07:44:24 字數 1443 閱讀 2762

一、安裝nginx需要如下環境

參考 :./configure --prefix=/usr/local/nginx --with-stream make &&make install

1、gcc

編譯依賴gcc環境,如果沒有gcc環境,需要安裝gcc

pcre(perl compatible regular expressions)是乙個perl庫,包括 perl 相容的正規表示式庫。nginx的http模組使用pcre來解析正規表示式,所以需要在linux上安裝pcre庫。

yum install -y pcre pcre-devel
3 、zlib

lib庫提供了很多種壓縮和解壓縮的方式,nginx使用zlib對http包的內容進行gzip,所以需要在linux上安裝zlib庫。

yum install -y zlib zlib-devel
4、openssl openssl 是乙個強大的安全套接字層密碼庫,囊括主要的密碼演算法、常用的金鑰和證書封裝管理功能及ssl協議,並提供豐富的應用程式供測試或其它目的使用。 nginx不僅支援http協議,還支援https(即在ssl協議上傳輸http),所以需要在linux安裝openssl庫。

yum install -y openssl openssl-devel
二、編譯安裝

將nginx-1.12.2.tar.gz拷貝至linux伺服器。

解壓: tar -zxvf nginx-1.12.2.tar.gz cd nginx-1.12.2

執行如下命令

開始安裝和 編譯

make && make install
檢視安裝目錄

whereis nginx
三、啟動nginx

去安裝目錄下執行./nginx

啟動

cd /usr/local/nginx/sbin/

./nginx

檢視nginx執行程序

ps -aux | grep nginx
其中13827為nginx的主程序id,13828為nginx的工作程序id

四、啟動nginx

cd /usr/local/nginx/sbin

./nginx -s reload

./nginx -s stop

./nginx -s quit

五、nginx測試

訪問對應安裝nginx的linux的ip,出現如下介面即安裝成功。

Linux Centos7下boost庫安裝

在安裝之前最好保證你的gcc是高版本的,否則有時候安裝高版本的boost會出錯。我是在root許可權下進行的這些操作。wget解壓壓縮包。tar zxvf boost 1 69 0.tar.gz進入boost 1 69 0,執行 cd boost 1 69 0 sudo bootstrap.sh p...

Linux Centos7 下Mysql的安裝

root bogon whereis mysql mysql usr bin mysql usr lib mysql usr share mysql usr share man man1 mysql.1.gz root bogon rpm qa grep mysql mysql community ...

Linux centos 系統目錄詳解

一 檔案系統的型別 普通檔案 如文字檔案 c語言元 shell指令碼 二進位制的可執行檔案等,可用cat less more vi emacs來察看內容,用mv來改名。目錄檔案 包括檔名 子目錄名及其指標。它是linux儲存檔名的唯一地方,可用ls列出目錄檔案。連線檔案 是指向同一索引節點的那些目錄...