SHELL编程---安装NGINX服务器并启动脚本
2018-03-09 16:05
507 查看
一、安装NGINX服务器
1.安装依赖包
首先这两个包要确保安装:
# rpm -q zlib-devel pcre-devel
未安装软件包 zlib-devel
未安装软件包 pcre-devel 如上面所示,没有就安装它俩:
[root@localhost ~]# yum -y install zlib-devel pcre-devel然后我们在检查一下,可见已经安装成功了:
rpm -q zlib-devel pcre-devel
zlib-devel-1.2.7-17.el7.x86_64
pcre-devel-8.32-17.el7.x86_642.添加系统用户
[root@localhost ~]# useradd -s /sbin/nologin nginx -M
[root@localhost ~]# tail -1 /etc/passwd
nginx:x:1000:1000::/home/nginx:/sbin/nologin
[root@localhost ~]# 3.源码编译安装NGINX
⑴下载源码包
去官网下载就行
⑵解压
[root@localhost douhei]# tar zxf nginx-1.10.3.tar.gz -C /usr/src/
[root@localhost douhei]# cd /usr/src
[root@localhost src]# ls
debug kernels nginx-1.10.3⑶先安装C++程序
yum -y install gcc-c++⑷安装NGINX
./configure --user=nginx --group=nginx --prefix=/usr/local/nginx然后在make一下:
[root@localhost nginx-1.10.3]# make最后再
[root@localhost nginx-1.10.3]# make install⑸启动NGINX
[root@localhost local]# /usr/local/nginx/sbin/nginx如下表示NGINX已经启动了:
[root@localhost local]# netstat -anlpt | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6656/nginx: master
1.安装依赖包
首先这两个包要确保安装:
# rpm -q zlib-devel pcre-devel
未安装软件包 zlib-devel
未安装软件包 pcre-devel 如上面所示,没有就安装它俩:
[root@localhost ~]# yum -y install zlib-devel pcre-devel然后我们在检查一下,可见已经安装成功了:
rpm -q zlib-devel pcre-devel
zlib-devel-1.2.7-17.el7.x86_64
pcre-devel-8.32-17.el7.x86_642.添加系统用户
[root@localhost ~]# useradd -s /sbin/nologin nginx -M
[root@localhost ~]# tail -1 /etc/passwd
nginx:x:1000:1000::/home/nginx:/sbin/nologin
[root@localhost ~]# 3.源码编译安装NGINX
⑴下载源码包
去官网下载就行
⑵解压
[root@localhost douhei]# tar zxf nginx-1.10.3.tar.gz -C /usr/src/
[root@localhost douhei]# cd /usr/src
[root@localhost src]# ls
debug kernels nginx-1.10.3⑶先安装C++程序
yum -y install gcc-c++⑷安装NGINX
./configure --user=nginx --group=nginx --prefix=/usr/local/nginx然后在make一下:
[root@localhost nginx-1.10.3]# make最后再
[root@localhost nginx-1.10.3]# make install⑸启动NGINX
[root@localhost local]# /usr/local/nginx/sbin/nginx如下表示NGINX已经启动了:
[root@localhost local]# netstat -anlpt | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6656/nginx: master
相关文章推荐
- 虚拟机Linux系统安装nginx服务器并启动的步骤
- nginx 安装、编写启动脚本、配置
- nginx服务器安装与启动
- 虚拟机Linux系统安装nginx服务器并启动的步骤
- 源码安装Nginx服务启动脚本
- RHEL6编译安装nginx、开机启动脚本
- nginx在windows下的安装,以及编写启动关闭nginx等操作的脚本
- 关于nginx不能随服务器启动而正常启动的修复脚本
- nginx的编译安装以及启动脚本编写
- centos LNMP第一部分环境搭建 LAMP LNMP安装先后顺序 php安装 安装nginx 编写nginx启动脚本 懒汉模式 mv /usr/php/{p.conf.default,p.conf} php运行方式SAPI介绍 第二十三节课
- nginx编译安装服务启动脚本示例
- Centos7 编译安装nginx1.10.2 脚本启动失败解决思路
- nginx服务器安装启动及配置文件详解
- nginx安装配置启动,把前端的请求一部分转发到本地,ajax请求转发到服务器。
- window server2012服务器上如何安装nginx并启动
- Nginx服务安装与启动脚本配置
- windows php nginx服务器搭建 配置 创建启动 停止 重启脚本
- Nginx服务安装与启动脚本配置
- linux 安装了memcache模块,phpinfo加载不了 & Nginx和PHP-FPM的启动/重启脚本
- 【shell编程】 nginx 服务的启动脚本