最近学习ngnix,学习前先让我们看看,如何安装。
ngnix下载地址:http://nginx.org/en/download.html
官网安装文档:http://nginx.org/en/docs/install.html
这边主要介绍,通过下载ngnix源码,如何通过编译的方式进行安装和启动:
(1)将下载下来的安装包解压,其中需要注意的是,安装ngnix,需要系统提前安装openssl和zlib,如果未安装,请提前安装。
openssl下载地址:https://www.openssl.org/
zlib下载地址:http://www.zlib.net/
(2)进入ngnix目录,执行如下命令进行安装配置
./configure
--sbin-path=/usr/local/nginx/nginx
--conf-path=/usr/local/nginx/nginx.conf
--pid-path=/usr/local/nginx/nginx.pid
--with-http_ssl_module
--with-pcre=../pcre-8.41
--with-zlib=../zlib-1.2.11
(3)使用如下命令进行安装
make make install
(4)启动ngnix
cd /usr/local/nginx/ ./ngnix
(5)验证结果