linux redhat nginx,redhat 安装nginx过程完整记录

1、下载nginx安装包

在nginx官网http://nginx.org/ 下载linux的安装包nginx-1.13.8.tar.gz

2、上传到linux

用xftp上传到linux   /opt目录,之后解压。

tar -xzf nginx-1.13.8.tar.gz

3、编译nginx

[root@localhost opt]# cd nginx-1.13.8

[root@localhost nginx-1.13.8]# ./configure

报错,提示没有pcre库。

./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= option.

4、安装pcre

在pcre官网http://www.pcre.org/下载压缩包pcre-8.41.tar.gz  ,同样上传到/opt目录

解压 tar -xzf pcre-8.41.tar.gz

安装pcre ,先编译

[root@localhost pcre-8.41]# ./configure

没通过,报错:

configure: error: You need a C++ compiler for C++ support.

需要安装c++编译器

[root@localhost pcre-8.41]# yum install -y gcc gcc-c++

安装成功后,再次编译pcre,通过。

make && make install

5、再次编译nginx

重复第三步动作

6、安装nginx

make&&make install

安装成功。安装目录:/usr/local/nginx

7、启动并验证

cd /usr/local/nginx

[root@localhost nginx]# ./sbin/nginx

./sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

再次报错

8、解决这个问题

增加软连接:

执行ls /lib64/ | grep pcre

会显示如下信息:

libpcre.so.0

libpcre.so.0.0.1

然后添加软连接:

执行命令ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1

[root@localhost nginx]# ls /lib64/ | grep pcre

libpcre.so.0

libpcre.so.0.0.1

[root@localhost nginx]# ln -s /lib64/libpcre.so.0.0.1 /lib64/libpcre.so.1

[root@localhost nginx]# ./sbin/nginx

9、再次启动并验证

[root@localhost nginx]# ./sbin/nginx

[root@localhost nginx]# ps -ef|grep ngnix

root 30494 19701 0 05:37 pts/0 00:00:00 grep ngnix

[root@localhost nginx]# ps -ef|grep nginx

root 30490 1 0 05:37 ? 00:00:00 nginx: master process ./sbin/nginx

nobody 30491 30490 0 05:37 ? 00:00:00 nginx: worker process

root 30496 19701 0 05:37 pts/0 00:00:00 grep nginx

浏览器访问正常。完成。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值