linux 非root用户安装nginx

第一步:首先下载依赖包

下载地址 pcre(www.pcre.org),zlib(www.zlib.org),openssl(www.openssl.org)

第二步:上传那个nginx的安装包

下载nginx安装包,解压

[bdctool@localhost setup]$ tar  -zxvf nginx-1.12.2.tar.gz

[bdctool@localhost setup]$ ./configure  --with-http_stub_status_module --prefix=/opt/aspire/product/bdctool/nginx  

 报错

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

3、还是安装一下pcre吧

[bdctool@localhost setup]$ unzip  pcre-8.10.zip

[bdctool@localhost setup]$ cd  pcre-8.10

[bdctool@localhost pcre-8.10]$ ./configure    --prefix=/opt/aspire/product/bdctool/nginx/zzw_other/pcre-8.10 (自定义目录)

[bdctool@localhost pcre-8.10]$ make

[bdctool@localhost pcre-8.10]$ make install

4、再来安装nginx,首先./configure(这里是个坑,可以不操作,继续往下看--转载注)

 [bdctool@localhost nginx-1.12.2]$./configure  --with-http_stub_status_module  --prefix=/opt/aspire/product/bdctool/nginx  --with-pcre=/opt/aspire/product/bdctool/nginx/zzw_other/pcre-8.10

注意:上面命令--prefix=路径为nginx想要安装到的目录, --with-pcre=路径为pcre安装到的目录。

5、修改 --with-pcre=后的路径为pcre的解压后的源路径,重新./configure 

 [bdctool@localhost nginx-1.12.2]$./configure  --with-http_stub_status_module  --prefix=/opt/aspire/product/bdctool/nginx  --with-pcre=/opt/aspire/product/bdctool/setup/pcre-8.10(注意这个是pcre的源码路径

原文路径:https://blog.csdn.net/lzs_xiaoze/article/details/85632144

6,执行make 命令

7,执行make install 命令来着

原文地址:https://www.cnblogs.com/Hackerman/p/12022596.html