一、nginx安裝
1、安裝make:
yum -y install gcc automake autoconf libtool make
2、安裝g++:
yum install gcc gcc-c++/
3、安裝pcre和pcre-devel
yum install -y pcre pcre-devel
4、安裝zlib zlib提供了很多壓縮和解方式,nginx需要zlib對http進行gzip
yum install -y zlib zlib-devel
5、安裝openssl openssl是一個安全套接字層密碼庫,nginx要支持https,需要使用openssl
yum install -y openssl openssl-devel
6、下載nginx
wget http://nginx.org/download/nginx-1.14.2.tar.gz
7、解壓
tar -zxvf nginx-1.14.2.tar.gz
8、安裝到指定目錄
cd到文件路徑
./configure \
--prefix=你想要安裝的目錄 \
--sbin-path=/你想要安裝的目錄/nginx \
--conf-path=/你想要安裝的目錄/nginx.conf \
--pid-path=/你想要安裝的目錄/nginx.pid \
--with-http_ssl_module \
--with-pcre=/usr/local/pcre-8.38 \
--with-zlib=/usr/local/zlib-1.2.11 \
--with-openssl=/usr/local/openssl-1.0.1t
9、安裝
make && make install
10、啟動
nginx
11、重啟
nginx -s reload
12、如果您正在運行防火墻,請運行以下命令以允許HTTP和HTTPS通信:
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload