linux nginx 安裝啟動

2022-09-02 16:33:19 字數 1186 閱讀 7997

首先安裝必要的庫(nginx 中gzip模組需要 zlib 庫,rewrite模組需要 pcre 庫,ssl 功能需要openssl庫)。選定**/usr/local**為安裝目錄,以下具體版本號根據實際改變。

1.安裝gcc gcc-c++(如新環境,未安裝請先安裝)

$ yum install -y gcc gcc-c++

2.安裝pcre庫

$ cd /usr/local/

$ wget 

$ tar -zxvf pcre-8.36.tar.gz

$ cd pcre-8.36

$ ./configure

$ make && make install

如報錯:configure: error: you need a c++ compiler for c++ support

解決:yum install -y gcc gcc-c++

3.安裝ssl庫

$ cd /usr/local/

$ wget

$ tar -zxvf openssl-1.0.1j.tar.gz

$ cd openssl-1.0.1j

$ ./config

$ make && make install

4.安裝zlib庫存

$ cd /usr/local/

$ wget 

$ tar -zxvf zlib-1.2.11.tar.gz

$ ./configure

$ make && make install

然後就是安裝nginx了

./configure

make && make install

預設配置會安裝到 /usr/local/nginx  下

進入sbin目錄;輸入 ./nginx 就可以啟動了 

./nginx 開啟

./nginx -s stop 停止

./nginx -s quit

./nginx -s reload

以上方式在配置ssl證書時會報錯,./configure出了問題,更好的安裝方式如下

linux nginx 重啟 關閉 啟動

啟動操作 nginx c usr local nginx conf nginx.conf c引數指定了要載入的nginx配置檔案路徑 停止操作 停止操作是通過向nginx程序傳送訊號來進行的 步驟1 查詢nginx主程序號 ps ef grep nginx在程序列表裡 面找master程序,它的編號...

Linux Nginx 安裝筆記

環境 vmware workstation 10,centos 7 x86 64 1511.iso,xshell 4.0,ip 192.168.216.140 root localhost yum list nginx yum檢視nginx安裝資訊 已載入外掛程式 fastestmirror loa...

LINUX nginx服務安裝

安裝 yum install epel relase y yum install nginx y 安裝完可以檢視nginx的配置資訊檔案 vim etc nginx nginx.conf 修改完conf檔案,則應重啟nginx軟體 不推薦 systemctl restart nginx system...