nginx 需要的依賴包
gcc gcc-c++ make libtool zlib zlib-devel openssl openssl-devel pcre pcre-devel
如果上述包都沒有安裝,需先安裝。如你的服務器是阿里雲服務器的話,直接執行zypper install 包名 ,挨個安裝。
否則就wget 到服務器之后,自己安裝。
進入正題
安裝nginx
1,下載nginx
2, 解壓
tar -zxvf nginx-1.12.0.tar.gz
2,配置 --with-pcre 指定在編譯中使用的動態庫 --prefix 安裝位置
./configure --prefix=/usr/local/nginx --prefix=/usr/local/nginx --with-pcre --with-http_stub_status_module --with-http_ssl_module
3,編譯,安裝
make
make install
4.測試是否安裝成功
切換到/usr/local/nginx目錄,執行 ./nginx -t,提示如下信息,說明安裝成功
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful