想自己安装nginx,又不相用到root用户。

非root用户下(本文为用户bdctool)来ngnix安装,要依赖pcre库、zlib库等,

1、 下载依赖包:下载地址 pcre(www.pcre.org),zlib(www.zlib.org),openssl(www.openssl.org)

2、不用依赖包,先安装一下试试

[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安装到的目录。

.....................
checking for openat(),
fstatat() ... found
checking for getaddrinfo() ... found
checking for zlib
library ... found
creating objs/Makefile

Configuration summary
  + using PCRE library:
/opt/aspire/product/bdctool/nginx/zzw_other/pcre-8.10
 
+ OpenSSL library is not used  
--- OpenSSL  可选
  + using system zlib library    ---
其实是要依赖zlib包的,但系统已安装,所以没有额外安装,如果系统没安装,要自行如pcre一样安装一下,并且在configure时加
--with-zlib=(自行安装的zlib的目录)

nginx path prefix:
"/opt/aspire/product/bdctool/nginx"
  nginx binary file:
"/opt/aspire/product/bdctool/nginx/sbin/nginx"
  nginx modules path:
"/opt/aspire/product/bdctool/nginx/modules"
  nginx configuration prefix:
"/opt/aspire/product/bdctool/nginx/conf"
  nginx configuration file:
"/opt/aspire/product/bdctool/nginx/conf/nginx.conf"
  nginx pid file:
"/opt/aspire/product/bdctool/nginx/logs/nginx.pid"
  nginx error log file:
"/opt/aspire/product/bdctool/nginx/logs/error.log"
  nginx http access log
file: "/opt/aspire/product/bdctool/nginx/logs/access.log"
  nginx http client
request body temporary files: "client_body_temp"
  nginx http proxy temporary
files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
 
nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary
files: "scgi_temp"

没什么大问题

4、再进行make

[bdctool@localhost nginx-1.12.2]$ make
make -f
objs/Makefile
make[1]: Entering directory
`/opt/aspire/product/bdctool/setup/nginx-1.12.2'
cd
/opt/aspire/product/bdctool/nginx/zzw_other/pcre-8.10 \
        && if
[ -f Makefile ]; then make distclean; fi \
        && CC="cc"
CFLAGS="-O2 -fomit-frame-pointer -pipe " \
        ./configure
--disable-shared
/bin/sh: line 2: ./configure: 没有那个文件或目录
make[1]: ***
[/opt/aspire/product/bdctool/nginx/zzw_other/pcre-8.10/Makefile] 错误
127
make[1]: Leaving directory
`/opt/aspire/product/bdctool/setup/nginx-1.12.2'
make: *** [build] 错误
2

出问题了,make报错。

参考《http://www.cnblogs.com/yayagepei/articles/1884462.html》的解决方法
,原来是--with-pcre=让你设置到源码目录,而不是编译安装后的目录;同样的道理, --with-zlib=也是解压后的源码目录,而不是zlib编译安装后的目录!!!!。这点与apache的编译还有点不同。用./configure 
-help 可以看配置参数帮助

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

6、重新make

[bdctool@localhost nginx-1.12.2]$ make

成功了,没出问题

7、最后make install

[bdctool@localhost nginx-1.12.2]$ make 
install

完成,没出问题

8、不改配置,试着启动一下

[bdctool@localhost sbin]$ ./nginx
nginx: [emerg]
bind() to 0.0.0.0:80 failed (13: Permission denied)

启动不了的,因为非root用户启动不了1024以下端口,具体解决方法见 http://www.cnblogs.com/zzw-zyba/p/8575428.html

9、修改一下nginx.conf监听端口为1024以上端口,重新启动nginx,成功。

参考《http://www.runoob.com/linux/nginx-install-setup.html

 
 
 

zzw原创_非root用户下安装nginx的更多相关文章

  1. zzw原创_非root用户启动apache的问题解决(非root用户启动apache的1024以下端口)

    场景:普通用户编译的apache,要在该用户下启动1024端口以下的apache端口 1.假设普通用户为sims20,用该用户编译 安装了一个apache,安装路径为/opt/aspire/produ ...

  2. zzw原创_非root安装fastDFS

    zzw原创_非root安装fastDFS fastDFS 想要非root安装,没找到资料,分析了一下安装脚本,原来作者是留了安装路径的,但没有放出来. 1.解包 [bdc@svr001 setup]$ ...

  3. linux非root用户下安装软件,搭建生产环境

    之前的用实验室的服务器,因为某些原因,使用的用户没有root权限.linux的非root用户很多软件无法安装,非常的不方便.我的方法是使用brew来代替系统的包管理工具.brew是最先用在mac上的包 ...

  4. CentOS6非root用户下安装及配置CDH5.3.0

    #install lsb packagesudo yum install -y redhat-lsb #install net-tools package sudo yum install -y ne ...

  5. Linux下非root用户如何安装软件

    Linux下非root用户如何安装软件 从windows转移到Linux的用户最开始总会有各种不适,因为这种不适最终放弃linux的不在少数.对于这类人只能说可惜,还没有领略到linux的美好就过早放 ...

  6. [转载]Linux下非root用户如何安装软件

    [转载]Linux下非root用户如何安装软件 来源:https://tlanyan.me/work-with-linux-without-root-permission/ 这是本人遇到的实际问题,之 ...

  7. ubuntu下非root用户下获得使用wireshark的权限

    在非root用户下不能使用wireshark用来抓包,所以需要进行以下操作: sudo groupadd wireshark sudo chgrp wireshark /usr/bin/dumpcap ...

  8. 8、非root权限下安装perl以及perl模块

    转载:http://www.cnblogs.com/nkwy2012/p/6418669.html 转载自http://www.zilhua.com 在本博客中,所有的软件安装都在服务器上,且无roo ...

  9. 非root模式下安装mysql php小记

    假设你的home目录为/home/work mysql-server 安装 1. 下载mysql.tar.gz wget http://dev.mysql.com/get/Downloads/MySQ ...

随机推荐

  1. js的常见的三种密码加密方式-MD5加密、Base64加密和解密和sha1加密详解总结

    写前端的时候,很多的时候是避免不了注册这一关的,但是一般的注册是没有任何的难度的,无非就是一些简单的获取用户输入的数据,然后进行简单的校验以后调用接口,将数据发送到后端,完成一个简单的注册的流程,那么 ...

  2. mysql语法之case when then与列转行

    mysql语法中case when then与列转行的使用场景非常丰富. case语句类似java中条件分支语句的作用,可以类比java中的switch语句或者if语句来学习. 其语法如下: case ...

  3. The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application问题解决方案参考

    错误信息:The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the ...

  4. xampp——apache服务启动问题(端口占用)

    Apache启动提示 20:39:02 [Apache] Error: Apache shutdown unexpectedly.20:39:02 [Apache] This may be due t ...

  5. 自制操作系统Antz(13) 显示图片

    显示图片只是在多媒体课上看着bmp格式图片的突发奇想,然后就实现在了我自己的操作系统 Antz系统更新地址 Linux内核源码分析地址 Github项目地址 效果图: 显示图片的原理 在之前显卡操作时 ...

  6. Python模块1

    序列化模块: 将原本的字典.列表等内容转换成一个字符串的过程就叫做序列化. 序列化的目的 1.以某种存储形式使自定义对象持久化: 2.将对象从一个地方传递到另一个地方. 3.使程序更具维护性. jso ...

  7. 如何在cisco官网上下载Cisco packet tracer模拟器

    这个是“思科网络技术学院”提供的一个软件,需要注册成为学员以后才能用,注册名字可以更改. 进入网站后,上面七个选项,cisco Networking Academy.课程(下边第七个选项“Packet ...

  8. windows下安装git和vundle

    git在windows下的版本是: git-for-windows, 或者说是: msysgit: ms-sys-git 直接在 https://gitforwindows.org/上下载 git对w ...

  9. HDU 1542 Atlantis(扫描线)题解

    题意:给n个可能相交的矩形,问你不重复的总面积 思路:扫描线,一边扫一边加. 扫描线:图片来源:理解扫描线 假设我们要算以下四个矩形面积,显然中间深色的是重复的.我们按照x的大小,从左往右扫,然后用线 ...

  10. 利用 Charles Proxy 下载旧版本 iOS App

    一.软件准备 1.旧版本 iTunes1.IPSW Downloads:https://ipsw.me/2.百度网盘链接: https://pan.baidu.com/s/1PO9Z12o-rqZ_J ...