1. 切換到root用戶或者sudo 安裝依賴組件nginx
yum -y install wget vim gcc gd-devel gd-devel GeoIP-devel zlib-devel pcre-devel openssl-devel gd-devel libxslt-devel
2. 進入執行安裝編譯的工做目錄,從官網下載nginx-1.14.2.tar.gzvim
wget http://nginx.org/download/nginx-1.14.2.tar.gz tar zxvf nginx-1.14.2.tar.gz cd nginx-1.14.2
3. 執行編譯並安裝bash
./configure --prefix=../nginx --sbin-path=../nginx/sbin --conf-path=../nginx/conf/nginx.conf --http-log-path=../logs/nginx/access.log --error-log-path=../logs/nginx/error.log --pid-path=../nginx/var/run/nginx.pid --lock-path=../nginx/var/lock/subsys/nginx --user=work --group=work --with-poll_module --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module
make && make installdom
說明一下,我這裏安裝編譯參數路徑部分用的都是相對路徑,你在參考編譯的時候,可根據實際狀況進行替換。code