一、下載Nginx以及依賴組件
[root@localhost src]# wget http://nginx.org/download/nginx-1.10.2.tar.gz [root@localhost src]# wget http://www.openssl.org/source/openssl-fips-2.0.10.tar.gz [root@localhost src]# wget http://zlib.net/zlib-1.2.11.tar.gz [root@localhost src]# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
安裝C++編譯環境
[root@localhost src]# yum install gcc-c++
安裝Nginx及相關組件
openssl安裝
[root@localhost src]# tar zxvf openssl-fips-2.0.10.tar.gz
省略安裝內容... [root@localhost src]# cd openssl-fips-2.0.10 [root@localhost openssl-fips-2.0.10]# ./config && make && make install
省略安裝內容...
pcre安裝
[root@localhost src]# tar zxvf pcre-8.40.tar.gz
省略安裝內容... [root@localhost src]# cd pcre-8.40 [root@localhost pcre-8.40]# ./configure && make && make install
省略安裝內容...
zlib安裝
[root@localhost src]# tar zxvf zlib-1.2.11.tar.gz
省略安裝內容... [root@localhost src]# cd zlib-1.2.11 [root@localhost zlib-1.2.11]# ./configure && make && make install
省略安裝內容...
nginx安裝
[root@localhost src]# tar zxvf nginx-1.10.2.tar.gz
省略安裝內容... [root@localhost src]# cd nginx-1.10.2 [root@localhost nginx-1.10.2]# ./configure && make && make install
省略安裝內容...
3、啟動Nginx
nginx的基本操作
啟動 [root@localhost ~]# /usr/local/nginx/sbin/nginx 停止/重啟 [root@localhost ~]# /usr/local/nginx/sbin/nginx -s stop(quit、reload) 命令幫助 [root@localhost ~]# /usr/local/nginx/sbin/nginx -h 驗證配置文件 [root@localhost ~]# /usr/local/nginx/sbin/nginx -t 配置文件 [root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf