安装nginx:
cd /usr/local/src
下载:
wget http://nginx.org/download/nginx-1.9.9.tar.gz
解压:
tar -zxvf nginx-1.9.9.tar.gz
进入目录:
cd nginx-1.9.9
编译(nginx默认不支持https,安装时需要加载Https模块,–prefix:指定安装目录,–with-http_ssl_module支持HTTPS,如果这一步报错接着往下看):
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
安装:
make
make install
备注:make: *** No rule to make target `build', needed by `default'. Stop.
执行:yum -y install make zlib-devel gcc-c++ libtool openssl openssl-devel;再./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
备注:#如果./configure 报错 OpenSSL library not found,说明缺失OpenSSL库( crypto是OpenSSL 加密库(lib), 这个库需要openssl-devel包 ,在ubuntu中就是 libssl-dev )
执行下面命令:
yum -y install openssl-devel ll
然后重新执行
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make
make install
启动nginx:
cd /usr/local/nginx
启动:
./sbin/nginx