# 1. 解壓
tar -zxvf nginx-1.4.7.tar.gz
cd nginx-1.4.7
# 2. 配置(指定安裝前綴,避免 make 報錯)
./configure --prefix=/usr/local/nginx
# 3. 編譯
make
# 4. 安裝
make install
./configure: error: the HTTP rewrite module requires the PCRE library.
解決:
yum -y install pcre-devel
./configure: error: the HTTP cache module requires md5 functions from OpenSSL library...
解決:
yum -y install openssl openssl-devel
# 啟動
/usr/local/nginx/sbin/nginx
# 配置修改後,先測試語法
/usr/local/nginx/sbin/nginx -t
# 熱重載(平滑重啟,不殺進程)
/usr/local/nginx/sbin/nginx -s reload
瀏覽器訪問 https://server_ip,出現「Welcome to nginx!」頁面即表示安裝成功。
systemd 或 chkconfig)logrotate)worker_processes、worker_connections、緩存、Gzip 等參數configure 時加入 --with-http_ssl_module