下载nginx包

nginx-1.10.3.tar.gz

解压

[root@localhost src]# tar -zxvf nginx-1.10.3.tar.gz
[root@localhost src]# cd nginx-1.10.3
[root@localhost nginx-1.10.3]# ./configure
checking for OS
+ Linux 3.10.0-229.el7.x86_64 x86_64
checking for C compiler ... not found
./configure: error: C compiler cc is not found

安装gcc编译环境

[root@localhost nginx-1.10.3]# yum install gcc-c++
已安装:
gcc-c++.x86_64 0:4.8.3-9.el7
作为依赖被安装:
cpp.x86_64 0:4.8.3-9.el7 gcc.x86_64 0:4.8.3-9.el7 glibc-devel.x86_64 0:2.17-78.el7
glibc-headers.x86_64 0:2.17-78.el7 kernel-headers.x86_64 0:3.10.0-229.el7 libmpc.x86_64 0:1.0.1-3.el7
libstdc++-devel.x86_64 0:4.8.3-9.el7 mpfr.x86_64 0:3.1.1-4.el7

安装依赖包

如果直接安装会包错
./configure: error: the HTTP rewrite module requires the PCRE library.
[root@localhost nginx-1.10.3]# yum install pcre pcre-devel -y
[root@localhost nginx-1.10.3]# yum install zlib zlib-devel -y
[root@localhost nginx-1.10.3]# yum install openssl openssl--devel -y

安装nginx

#配置检测 指定安装目录
[root@localhost nginx-1.10.3]# ./configure --prefix=/usr/local/nginx
Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ using builtin md5 code
+ sha1 library is not found
+ using system zlib library nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx modules path: "/usr/local/nginx/modules"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
#编译
[root@localhost nginx-1.10.3]# make
#安装
[root@localhost nginx-1.10.3]# make install

启动nginx

#启动
[root@localhost /]# /usr/local/nginx/sbin/nginx
#重启
[root@localhost /]# /usr/local/nginx/sbin/nginx -s reload
#关闭
[root@localhost /]# /usr/local/nginx/sbin/nginx -s stop
#启动成功
[root@localhost nginx]# ps -axu|grep nginx
root 17003 0.0 0.0 20432 604 ? Ss 22:11 0:00 nginx: master process /usr/local/nginx/sbin/nginx #查看防火墙状态
[root@localhost nginx]# firewall-cmd --state
#关闭防火墙服务
[root@localhost nginx]# systemctl stop firewalld

开机启动

[root@localhost nginx]# vim /lib/systemd/system/nginx.service
[Unit]
Description=nginx
After=network.target [Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s quit
PrivateTmp=true [Install]
WantedBy=multi-user.target #设置开机启动
[root@localhost nginx]# systemctl enable nginx.service
#停止开机自启动
[root@localhost nginx]# systemctl disable nginx.service

linux入门常用指令2.安装nginx的更多相关文章

  1. linux入门常用指令3.安装mysql

    下载安装包 MySQL-5.6.42-1.el6.x86_64.rpm-bundle_redhat [root@localhost src]# mkdir mysql [root@localhost ...

  2. Linux入门常用指令

    linux获取硬盘和目录大小的命令 df命令 Linux下可以用df命令获取硬盘的使用情况,通过man可以获取df命令的详细情况.df命令经常用的参数为: a:显示全部的档案系统和各分割区的磁盘使用情 ...

  3. linux入门常用指令4.挂载数据盘

    挂载硬盘 #查看当前分区情况 [root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sdb 8:16 0 5G 0 dis ...

  4. linux入门常用指令1.配置本地yum源

    创建光盘挂载点 [root@localhost /]# mkdir /mnt/cdrom 挂载光盘 #挂载光盘 [root@localhost /]# mount /dev/cdrom /mnt/cd ...

  5. 在Linux和Windows系统上安装Nginx服务器的教程

    在Linux和Windows系统上安装Nginx服务器的教程  1.在CentOS系统上安装Nginx 在 CentOS6 版本的 EPEL 源中,已经加入了 nginx 的 rpm 包,不过此 RP ...

  6. (转)Linux最常用指令及快捷键 Linux学习笔记

    Linux最常用指令及快捷键 Linux学习笔记 原文:http://blog.csdn.net/yanghongche/article/details/50827478 [摘自 鸟叔的私房菜]--转 ...

  7. Linux文件常用指令

    目录 Linux文件常用指令 1.pwd 显示当前目录 2.cd 切换目录 3.mkdir 创建目录 4.touch 修改或创建文件 5.ls 显示目录下的内容 6.cat 查看文件信息 7.echo ...

  8. Linux入门50指令

    1, mkdir创建目录 make directory 可以带着路径,在什么位置创建什么目录 如:mkdir /etc/date  在目录etc下创建date目录 重要参数 –p 递归创建,mkdir ...

  9. linux软件管理之------编译安装nginx服务器并手动编写自动化运行脚本

    红帽系列的 linux软件管理分为三类:1. rpm 安装软件.2. yum 安装软件.3. 源码包编译安装.前面两种会在相关专题给出详细讲解.源码包的编译安装是非常关键的,我们知道linux的相关版 ...

随机推荐

  1. Java 代码快速注释 和 取消注释

    注释掉代码: 把要注释的代码选中: 加/* */ 形式的注释  ->  Ctrl+Shift+/ 加 //形式的形式的注释 ->  ctrl+/ 取消代码注释: 把要取消注释的代码选中: ...

  2. 微信小程序 仿‘得到app’分类列表页

    今天另起一篇,贴出完整的代码,大概思路是左侧大分类列表,点击后联动右侧二级分类,及下面文章列表,点击二级分类也联动下面文章列表. 代码如下: <view class="page&quo ...

  3. 【MOOC课程学习记录】程序设计与算法(一)C语言程序设计

    课程结课了,把做的习题都记录一下,告诉自己多少学了点东西,也能给自己一点鼓励. ps:题目都在cxsjsxmooc.openjudge.cn上能看到,参考答案在差不多结课的时候也会在mooc上放出来. ...

  4. 【FFMPEG】Windows下使用Visual Studio 2010编译ffmpeg全过程

    原文  http://www.cnblogs.com/xylc/p/3683203.html 主题 FFmpegWindowsVisual Studio ffmpeg是一个开源的多媒体库,使用非常广泛 ...

  5. VC程序运行时间测试函数

    VC程序运行时间测试函数 介绍 我们在衡量一个函数运行时间,或者判断一个算法的时间效率,或者在程序中我们需要一个定时器,定时执行一个特定的操作,比如在多媒体中,比如在游戏中等,都会用到时间函数.还比如 ...

  6. jquery清除元素的点击事件

    $("#id").css("pointer-events", "none");

  7. nginx passwd (http://www.voidcn.com/article/p-suebfyqy-nx.html)

    操作系统CentOS 7.2 nignx 1.10.1 首先我们用Nginx提供HTTP的Basic Auth功能,配置了需要输入的用户名和密码,才能访问网站. 我们使用htpasswd来生成密码信息 ...

  8. 【青橙商城-管理后台开发】3. web模块搭建

    [青橙商城-管理后台开发]3. web模块搭建 1.创建qingcheng_web_manager模块 pom.xml <?xml version="1.0" encodin ...

  9. NOIP 2018 提高组初赛试题 题目+答案+简要解析

    一.单项选择题(共 10  题,每题 2  分,共计 20  分: 每题有且仅有一个正确选项)       1. 下列四个不同进制的数中,与其它三项数值上不相等的是( ). A. (269) 16 B ...

  10. PHP的四种运行方式

    一丶cgi协议模式 cgi模式通用网关接口(Common Gateway Interface),它允许web服务器通过特定的协议与应用程序通信,调用原理大概为:用户请求->Web服务器接收请求- ...