1. 从官网下载nginx.tar.gz源码包
  2. 拷贝至Linux系统下进行解压 tar -zxvf nginx.tar.gz
  3. 进入解压后的目录,需要./configure,此步骤会报多个错,比如没有安装gcc时,要求安装gcc等
  • ./confiure

在./configure时,可能会报错,如下:./configure: error: the HTTP rewrite module requires the PCRE library.You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option.

  • 解决办法是安装pcre-devel这个包,yum -y install pcre-devel   为了重写rewrite
  • 安装了上面这个包后,还会报错,提示./configure: error: the HTTP gzip module requires the zlib library. You can either disable the module by using --without-http_gzip_module option, or install the zlib library into the system, or build the zlib library statically from the source with nginx
  • 此时需要安装zlib-devel包,yum -y install  zlib-devel   为了gzip压缩

  4.make

  5.make install 或者4和5结合在一块,make && make install

  6.通过编译安装的程序都会保存在/usr/local目录下,如下:

  • [root@localhost nginx-1.14.0]# ls /usr/local/nginx/
    conf html logs sbin
    [root@localhost nginx-1.14.0]#

  7.运行命令 ./sbin/nginx就会启动nginx,通过ps -ef | grep nginx 或者通过netstat -anpl | grep 80可以查看进程或者端口状态

  • 访问 firefox localhost:80 ,如果出现如下界面,就表示nginx启动成功:

1.linux源码安装nginx的更多相关文章

  1. linux源码安装nginx

    任务目标:源码安装nginx,作为web服务修改配置文件,让配置生效,验证配置 首先要去官网nginx.org下载一个tar包: tar xvf 解包 进入到解包出来的目录,对configure进行配 ...

  2. linux 源码安装 Nginx

    1.安装前环境准备安装make:# yum -y install gcc automake autoconf libtool make安装g++:# yum install gcc gcc-c++ 2 ...

  3. Linux 源码安装nginx

    编译参数详解:https://www.cnblogs.com/houyongchong/p/compileArgs.html 配置参数详解:https://www.cnblogs.com/houyon ...

  4. Linux之源码安装nginx,并按照作业一描述的那样去测试使用

    作业五:源码安装nginx,并按照作业一描述的那样去测试使用 [root@localhost nginx]# yum install gcc-* glibc-* openssl openssl-dev ...

  5. 源码安装nginx以及平滑升级

                                                           源码安装nginx以及平滑升级                               ...

  6. Linux源码安装JDK1.8

    Linux源码安装Java 1.到官网下载 jdk-8u131-linux-x64.tar.gz 官网地址:http://www.oracle.com/technetwork/java/javase/ ...

  7. 源码安装Nginx以及用systemctl管理

    一.源码安装Nginx: 先安装gcc编译器(安装过的可以忽略) [root@localhost ~]# yum -y install gcc gcc-c++ wget 进入src目录 [root@l ...

  8. mysql-5.5 for linux源码安装

    mysql-5.5 for linux源码安装 1.使用Yum安装依赖软件包 # yum install -y gcc gcc-c++ gcc-g77 autoconf automake bison  ...

  9. 工作笔记-- 源码安装nginx

    源码安装nginx 1.安装nginx的依赖包 [root@localhost ~]# yum -y install gcc gcc-c++ openssl openssl-devel pcre pc ...

随机推荐

  1. ios --图片文字组合头像那点事

    /** 图片文字组合头像那点事 @param string 昵称 @param imageSize 图片尺寸 @param imageColor 图片颜色 @return 返回的 图片 */ + (U ...

  2. DB facade实现CURD

    数据表 CREATE TABLE IF NOT EXISTS students( `id` INT AUTO_INCREMENT PRIMARY KEY, `name` VARCHAR(255) NO ...

  3. 在CentOS中安装输入法

    1.需要root权限,所以要用root登录 ,或su root 2.yum install "@Chinese Support" 3.exit 4.回到桌面,system-> ...

  4. 关于 js 动态生成html 绑定事件失效的问题

    在实际问题中,也只到使用新版jq 的on 事件 进行动态元素的绑定: 是这样 (但是依然没有效果——): $('dom节点').on('click',function(){}) 之后经过查阅发现:正确 ...

  5. Unity3d Resources TextAsset 文本

    一些小型数据,可以用txt文本作为媒介,进行获取.传输.修改.存储: 比如:User1.2.3.txt,放入 Resources/Data 文件下: 一,Unity3d Resources.Load ...

  6. CodeIgniter框架——知识要点汇总

    NO1.学习要点: 一.CodeIgniter 框架的简介 二.CodeIgniter 框架的安装 三.CodeIgniter 框架的目录结构分析 四.CodeIgniter 框架是如何工作的? 五. ...

  7. (转)gethostbyname() -- 用域名或主机名获取IP地址

    struct hostent *gethostbyname(const char *name); 这个函数的传入值是域名或者主机名,例如"www.google.cn"等等.传出值, ...

  8. 关于VUe的生命周期小小的理解

    实例化初始化->beforeCreate()->数据监测->事件配置->实例已经创建完成(created),在这一步,实例已完成以下的配置:数据观测(data observer ...

  9. SQL之 Stuff和For xml path

    示例 昨天遇到一个SQL Server的问题:需要写一个储存过程来处理几个表中的数据,最后问题出在我想将一个表的一个列的多行内容拼接成一行,比如表中有两列数据 : 类别 名称 AAA 企业1 AAA ...

  10. coursera 《现代操作系统》 -- 第十周 文件系统(2)

    身份验证 Authentication 知道用户是谁.通过账号密码.Id 这样的识别出来. 访问控制 Permission 知道用户是谁后. 主动控制 记录用户ID和对应的访问权限 --> 记录 ...