CentOS7 下 Nginx 安裝部署

2021-09-12 14:32:46 字數 2074 閱讀 4560

nginx是一款高效能的web伺服器也可以用來做負載均衡及反向**使用,目前使用最多的就是負載均衡。由俄羅斯人igor sysoev(伊戈爾·賽索耶夫)為俄羅斯**rambler.ru開發的,在rambler.ru**平穩的執行了四年,而且俄羅斯超過20%的虛擬主機平台採用nginx作為反向**伺服器。

優點:

缺點:

2、安裝c++編譯環境

[root@localhost nginx]# yum install gcc-c++

3、安裝openssl

[root@localhost nginx]# tar -zxvf openssl-fips-2.0.9.tar.gz

[root@localhost nginx]# cd openssl-fips-2.0.9

[root@localhost openssl-fips-2.0.9]# ./config --prefix=/usr/local/nginx/openssl-2.0.9

[root@localhost openssl-fips-2.0.9]# make && make install

4、安裝pcre

[root@localhost nginx]# tar -zxvf pcre-8.42.tar.gz

[root@localhost nginx]# cd pcre-8.42

[root@localhost pcre-8.42]# ./configure --prefix=/usr/local/nginx/pcre-8.42

[root@localhost pcre-8.42]# make && make install

5、安裝zlib

[root@localhost nginx]# tar -zxvf zlib-1.2.11.tar.gz

[root@localhost nginx]# cd zlib-1.2.11

[root@localhost zlib-1.2.11]# ./configure --prefix=/usr/local/nginx/zlib-1.2.11

[root@localhost zlib-1.2.11]# make && make install

6、安裝nginx

在centos7中,由firewalld控制防火牆,預設啟用遠端連線22埠,因此需要開啟80埠。

1、firewall開啟或關閉埠的方法:

2、firewalld-cmd基本操作

檢視版本: firewall-cmd --version

檢視幫助: firewall-cmd --help

顯示狀態: firewall-cmd --state

檢視所有開啟的埠: firewall-cmd --zone=public --list-ports

更新防火牆規則: firewall-cmd --reload

檢視區域資訊: firewall-cmd --get-active-zones

檢視指定介面所屬區域: firewall-cmd --get-zone-of-inte***ce=eth0

拒絕所有包:firewall-cmd --panic-on

取消拒絕狀態: firewall-cmd --panic-off

檢視是否拒絕: firewall-cmd --query-panic

centos7下離線安裝nginx

一 準備工作 1 首先我的centos7,安裝是centos 7 x86 64 everything 1611的版本,2 把系統的映象檔案,找到packages檔案下,找到 pcre devel 8.32 15.el7 2.1.x86 64.rpm,zlib 1.2.7 17.el7.x86 64....

Centos7下編譯安裝Nginx

安裝前的的準備 1.安裝gcc g 開發類庫是否裝好 ububtu平台編譯環境可以使用以下指令 apt get install build essential apt get install libtool centos平台編譯環境使用如下指令 yum y install gcc automake ...

centos7下nginx的安裝

yum install y zlib zlib develyum install y openssl openssl devel 編譯安裝tar zxvf nginx 1.8.0.tar.gz cd nginx 1.8.0引數設定如下 nginx注意 執行.nginx啟動nginx,這裡可以 c指定...