linux编译 nginx,Linux编译程序nginx的安装简述

准备工作:从网上把nginx包下载到本地

然后打开mac终端输入以上命令将nginx包上传到Linux虚拟机

linfandeMacBook-Air:Desktop linfan$ scp nginx-1.12.2.tar.gz root@192.168.24.181:/root/

[root@linfan ~]# ls

anaconda-ks.cfg nginx-1.12.2.tar.gz //查看是否上传成功

[root@linfan ~]# tar xf nginx-1.12.2.tar.gz // 解压nginx包

[root@linfan ~]# ls

anaconda-ks.cfg nginx-1.12.2 nginx-1.12.2.tar.gz

[root@linfan ~]# cd nginx-1.12.2

[root@linfan nginx-1.12.2]# ./configure --prefix=/opt/nginx-1.12.2 //指定编译参数

checking for OS

.......

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

// 报错则根据提示安装源

[root@linfan nginx-1.12.2]# yum install -y pcre-devel

[root@linfan nginx-1.12.2]# yum install -y zlib-devel

[root@linfan nginx-1.12.2]# ./configure --prefix=/opt/nginx-1.12.2 再次执行指定编译参数命令

[root@linfan nginx-1.12.2]# echo $?

0

//检验这一步是否错误,非0即是上条命令错误

[root@linfan nginx-1.12.2]# make //编译

[root@linfan nginx-1.12.2]# make install //安装

[root@linfan nginx-1.12.2]# /opt/nginx-1.12.2/sbin/nginx //启动nginx服务

[root@linfan nginx-1.12.2]# echo $?

0

//检验这一步是否错误,非0即是上条命令错误

[root@linfan nginx-1.12.2]# ps -ef|grep nginx //查看nginx进程是否存在

root 20397 1 0 19:36 ? 00:00:00 nginx: master process /opt/nginx-1.12.2/sbin/nginx

nobody 20398 20397 0 19:36 ? 00:00:00 nginx: worker process

root 20400 2183 0 19:37 pts/1 00:00:00 grep --color=auto nginx

[root@linfan nginx-1.12.2]# ss -natl //查看nginx端口号是否存在

State Recv-Q Send-Q Local Address:Port Peer Address:Port

LISTEN 0 128 *:80 *:*

LISTEN 0 128 *:22 *:*

LISTEN 0 100 127.0.0.1:25 *:*

LISTEN 0 128 :::22 :::*

LISTEN 0 100 ::1:25 :::*

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值