nginx源码安装过程及出现的问题

Linux环境:CentOS7
操作软件:Xshell
安装nginx源码包nginx-1.5.1.tar.gz,文件可从nginx官网下载
[root@localhost]# cd /opt/

[root@localhost opt]# rz -E

[root@localhost opt]# ls
nginx-1.5.1.tar.gz  rh

[root@localhost opt]# tar xf nginx-1.5.1.tar.gz 

[root@localhost opt]# cd nginx-1.5.1/

[root@localhost nginx-1.5.1]# ls
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src

[root@localhost nginx-1.5.1]# ll
总用量 568
drwxr-xr-x. 6 tom tom   4096 5月  25 18:20 auto
-rw-r--r--. 1 tom tom 222750 6月   4 2013 CHANGES
-rw-r--r--. 1 tom tom 339122 6月   4 2013 CHANGES.ru
drwxr-xr-x. 2 tom tom    168 5月  25 18:20 conf
-rwxr-xr-x. 1 tom tom   2369 6月   4 2013 configure
drwxr-xr-x. 3 tom tom     61 5月  25 18:20 contrib
drwxr-xr-x. 2 tom tom     40 5月  25 18:20 html
-rw-r--r--. 1 tom tom   1397 6月   4 2013 LICENSE
drwxr-xr-x. 2 tom tom     21 5月  25 18:20 man
-rw-r--r--. 1 tom tom     49 6月   4 2013 README
drwxr-xr-x. 8 tom tom     77 5月  25 18:20 src 

[root@localhost nginx-1.5.1]# ./configure  --prefix=/usr/local/nginx
checking for OS
... 
... 
... 

报错1:缺少编译器gcc-c++
解决方法:yum install -y gcc-c++
报错2:缺少pcre函数库
./configure: error: the HTTP rewrite module requires the PCRE library......
解决方法:yum install -y pcre-devel
报错3:缺少zlib函数库

./configure: error: the HTTP rewrite module requires the zlib library......
解决方法:yum install -y zlib-devel
报错4:缺少openssl函数库

./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library......
解决方法:yum -y install openssl openssl-devel
解决完问题后继续进行安装,检测安装无误后进行编译

[root@localhost nginx-1.5.1]# ./configure  --prefix=/usr/local/nginx

[root@localhost nginx-1.5.1]# echo $?
0
[root@localhost nginx-1.5.1]# make

[root@localhost nginx-1.5.1]# make install

[root@localhost nginx-1.5.1]# cd /usr/local/nginx/ 
[root@localhost nginx]#  pwd
/usr/local/nginx
[root@localhost nginx]# ls
conf  html  logs  sbin
配置文件 网页 日志   启动程序

安装完毕
测试
[root@localhost nginx]# ls sbin
nginx
[root@localhost nginx]# cd sbin/
[root@localhost sbin]# ./nginx 
[root@localhost sbin]# systemctl stop httpd
[root@localhost sbin]# ps aux | grep nginx 
root      10116  0.0  0.0  24852   756 ?        Ss   19:00   0:00 nginx: master process ./nginx
nobody    10117  0.0  0.1  27332  1520 ?        S    19:00   0:00 nginx: worker process
root      10134  0.0  0.0 112728   968 pts/1    R+   19:00   0:00 grep --color=auto nginx

有master和worker证明已经打开了nginx服务

=============================
杀死nginx进程,关闭nginx服务

[root@localhost html]# killall nginx
[root@localhost html]# ps aux | grep nginx 
root      10591  0.0  0.0 112728   972 pts/1    R+   19:03   0:00 grep --color=auto nginx

卸载源码包 :rm -rf /usr/local/nginx
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值