1、去官网下载nginx源码包 下载地址: http://nginx.org/en/download.html,选择一个版本
2、分别下载openssl 、pcre(不能用pcre2) 、zlib源码包,并解压
3、进入nginx解压出来的目录 图中是nginx-1.12-1
运行 ./configure --with-pcre=../pcre-8.32 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.0.2l 生成makefile文件
然后运行 make命令
最后运行make install命令
此时,不出意外,应该安装成功了
4、启动nginx服务
在objs中有一个nginx的可执行文件。运行./nginx 服务就启动了。
访问服务器地址,成功!