【运维笔记】CentOS7 安装nginx-1.9.11

1、安装c语言环境:

[root@localhost opt]# rpm -qa|grep gcc
[root@localhost opt]# yum install gcc-c++
[root@localhost opt]# yum install -y pcre pcre-devel
yum -y install make zlib-devel gcc-c++ libtool openssl openssl-devel

2、下载nginx离线包:
下载地址:http://nginx.org/download/
下载版本:nginx-1.9.9.tar.gz

3、上传离线包 & 解压:

[root@localhost /]# cd /opt/nginx
[root@localhost nginx]# rz
[root@localhost nginx]# ls
nginx-1.9.11.tar.gz
[root@localhost nginx]# tar -zxvf nginx-1.9.11.tar.gz

4、编译安装nginx:

[root@localhost /]# cd /opt/nginx/nginx-1.9.11
[root@localhost nginx-1.9.11]# mkdir nginx
[root@localhost nginx-1.9.11]# ./configure --prefix=/opt/nginx/nginx-1.9.11
[root@localhost nginx-1.9.11]# make && make install
[root@localhost nginx-1.9.11]# make && make install

5、新建nginx日志目录 & 日志:

[root@localhost nginx-1.9.11]# mkdir -p /opt/nginx/nginx-1.9.11/logs
[root@localhost logs]# touch /opt/nginx/nginx-1.9.11/logs/error.log

6、新建启动脚本 & 修改nginx启动脚本:

[root@localhost nginx-1.9.11]# touch start.sh
[root@localhost nginx-1.9.11]# vi start.sh

7、脚本【start.sh】文件内容:

pkill -9 nginx
/opt/nginx/nginx-1.9.11/sbin/nginx

8、启动脚本:

[root@localhost nginx-1.9.11]# sh start.sh
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值