虚拟机 安装ngnix ????

1. yum install gcc-c++ 
2.yum install pcre pcre-devel 

yum -c /etc/yum.conf --installroot=/usr/local --releasever=/  install nginx

该命令简单解释如下:

-c /etc/yum.conf                  表示指定yum配置文件地址

--installroot=/usr/local        表示指定自定义的安装目录

 上面这个命令是通过yum 安装软件到指定路径 


3.yum install zlib zlib-devel 
4.yum install openssl openssl--devel 
5.  wget http://nginx.org/download/nginx-1.9.14.tar.gz
6. tar xvzf nginx-1.9.14.tar.gz

第七步和第八步都是切换到解压过后的文件夹执行命令

7. ./configure

这步如果不修改,会默认安装到,/usr/local/nginx 这个目录 

 

这样 ./configure --prefix=/usr/local/nginx-1.6 --with-pcre \     会默认寻找pcre

rpm -ql pcre    查看prce的安装路径


8.make && make install
9. cd /usr/local/nginx/sbin

 

 修改配置文件  配置ngnix的负载均衡方式

 

启动命令是在  /usr/local/nginx/sbin  目录下执行的

10. ./nginx   启动
 

 

 

 

容易遇到的错误:

cc1: all warnings being treated as errors
objs/Makefile:458: recipe for target 'objs/src/core/ngx_murmurhash.o' failed
make[1]: *** [objs/src/core/ngx_murmurhash.o] Error 1
make[1]: Leaving directory '/nginx-1.10.3'
Makefile:8: recipe for target 'build' failed

解决:

 

 

找到 -Werro 并去掉,在重新make && make install

 

容易遇到的错误:

也是在make的时候遇到的错误,版本不匹配

src/os/unix/ngx_user.c: In function ‘ngx_libc_crypt’:
src/os/unix/ngx_user.c:36:7: error: ‘struct crypt_data’ has no member named ‘current_salt’
cd.current_salt[0] = ~salt[0];
^
make[1]: *** [objs/Makefile:774: objs/src/os/unix/ngx_user.o] Error 1
make[1]: Leaving directory '/root/nginx-1.10.1'
make: *** [Makefile:8: build] Error 2

根据提示,到解压的文件夹,注释文件中的   cd.current_salt[0] = ~salt[0]

 

 重新编译打包

 

 

 

 

 
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值