源码安装

检查环境

[root@freedom yum]# getenforce
Disabled
[root@freedom yum]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since 四 2019-07-25 17:57:20 CST; 23min ago

安装lrzsz

lrzsz:Linux上传下载文件工具

[root@freedom yum]# yum install lrzsz -y
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
软件包 lrzsz-0.12.20-36.el7.x86_64 已安装并且是最新版本
无须任何处理

上传源码包

[root@freedom ~]# rz -E
rz waiting to receive.

解压缩源码包

[root@freedom ~]# ls
anaconda-ks.cfg  initial-setup-ks.cfg  nginx-1.15.1.tar.gz  公共  模板  视频  图片  文档  下载  音乐  桌面
[root@freedom ~]# tar zxf nginx-1.15.1.tar.gz 
[root@freedom ~]# cd nginx-1.15.1/
[root@freedom nginx-1.15.1]# ./configure

进行配置并解决依赖关系

./configure: error: C compiler cc is not found
[root@freedom nginx-1.15.1]# yum list |grep cc
[root@freedom nginx-1.15.1]# yum install gcc-* -y
[root@freedom nginx-1.15.1]# ./configure
./configure: error: the HTTP rewrite module requires the PCRE library.
[root@freedom nginx-1.15.1]# rpm -qa pcre
pcre-8.32-17.el7.x86_64

[root@freedom nginx-1.15.1]# yum install pcre-* -y
[root@freedom nginx-1.15.1]# ./configure
./configure: error: the HTTP gzip module requires the zlib library.
[root@freedom nginx-1.15.1]# rpm -qa zlib
zlib-1.2.7-18.el7.x86_64
[root@freedom nginx-1.15.1]# yum install zlib-* -y
[root@freedom nginx-1.15.1]# ./configure

编译

[root@freedom nginx-1.15.1]# make

安装

[root@freedom nginx-1.15.1]# make install

启动服务

[root@freedom nginx-1.15.1]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

查看端口

[root@freedom nginx-1.15.1]# netstat -anp|grep nginx
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      77837/nginx: master 
unix  3      [ ]         STREAM     CONNECTED     133307   77837/nginx: master  
unix  3      [ ]         STREAM     CONNECTED     133306   77837/nginx: master  

添加防火墙

[root@freedom nginx-1.15.1]# firewall-cmd --add-port=80/tcp
success
[root@freedom nginx-1.15.1]# firewall-cmd --add-port=80/tcp --permanent
success
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值