出处:https://www.cnblogs.com/hltswd/p/6956264.html

第一步:在centos下面下载 nginx 
         wget http://nginx.org/download/nginx-1.2.9.tar.gz

解压 tar zxf nginx-1.2.9.tar.gz
第二部:新建一个用户nginx在安装操作
        useradd nginx
        passwd nginx
第三步、解压和测试安装环境 ./configure --prefix=/var/nginx 
      安装过程中报错

checking for OS
 + Linux 2.6.32-220.el6.x86_64 x86_64
checking for C compiler ... not found

./configure: error: C compiler gcc is not found

解决方法:安装gcc
   yum install gcc

./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解决问题 (root用户下安装)
yum -y install pcre-devel

继续报错误

./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 by using --with-zlib=<path> option.

需要安装 yum install -y zlib-devel

在继续执行 ./configure --prefix=/opt/nginx  安装编译成功

第四步:

make && make install
第五步:

cd /var/nginx/sbin
./nginx

如果报错:

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

那说明80端口被占用,用命令netstat -ltunp查看一下是哪个服务占用了端口

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name 
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1547/mysqld 
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 1247/vsftpd 
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1233/sshd 
tcp 0 0 :::80 :::* LISTEN 1258/httpd 
tcp 0 0 :::22 :::* LISTEN 1233/ssh

可以看出需要把httpd服务关掉

service httpd stop

然后再运行./nginx就行了

然后打开浏览器输入IP地址  显示
Welcome to nginx!

xxxxxxxxx

安装成功

转载《centos6安装nginx最详细步骤》的更多相关文章

  1. 转载《Android LayoutInflater详解》

    在实际开发中LayoutInflater这个类还是非常有用的,它的作用类似于findViewById().不同点是LayoutInflater是用来找res/layout/下的xml布局文件,并且实例 ...

  2. Android LayoutInflater详解

      在实际开发中LayoutInflater这个类还是非常有用的,它的作用类似于findViewById().不同点是LayoutInflater是用来找res/layout/下的xml布局文件,并且 ...

  3. Android LayoutInflater详解(转)

    在实际开发中LayoutInflater这个类还是非常有用的,它的作用类似于findViewById().不同点是LayoutInflater是用来找res/layout/下的xml布局文件,并且实例 ...

  4. Android LayoutInflater详解 (转)

    在实际开发中LayoutInflater这个类还是非常有用的,它的作用类似于findViewById().不同点是LayoutInflater是用来找res/layout/下的xml布局文件,并且实例 ...

  5. Android——LayoutInflater详解

    在实际工作中,事先写好的布局文件往往不能满足我们的需求,有时会根据情况在代码中自定义控件,这就需要用到LayoutInflater. LayoutInflater在Android中是"扩展& ...

  6. <转> Android LayoutInflater详解

    在实际开发中LayoutInflater这个类还是非常有用的,它的作用类似于findViewById().不同点是LayoutInflater是用来找res/layout/下的xml布局文件,并且实例 ...

  7. [ 转载 ] Android设计模式详解

    从Android再来认识23种设计模式 ReadyShow 关注  0.2 2018.01.06 23:18* 字数 3855 阅读 2584评论 0喜欢 20 概况来看本文章的内容 创建型:5个 单 ...

  8. Android Notification 详解(一)——基本操作

    Android Notification 详解(一)--基本操作 版权声明:本文为博主原创文章,未经博主允许不得转载. 微博:厉圣杰 源码:AndroidDemo/Notification 文中如有纰 ...

  9. Android Notification 详解——基本操作

    Android Notification 详解 版权声明:本文为博主原创文章,未经博主允许不得转载. 前几天项目中有用到 Android 通知相关的内容,索性把 Android Notificatio ...

  10. Android ActionBar详解

    Android ActionBar详解 分类: Android2014-04-30 15:23 1094人阅读 评论(0) 收藏 举报 androidActionBar   目录(?)[+]   第4 ...

随机推荐

  1. 往jdk/bin目录中增加tcnative-1.dll文件以后报错 Can't load AMD 64-bit .dll on a IA 32-bit platform

    开始时,运行Tomcat控制台报错: The APR based Apache Tomcat Native library which allows optimal performance in pr ...

  2. kafka集群安装和kafka-manager

    1.软件环境 (3台服务器-测试)10.11.12.31 mykafka110.11.12.32 mykafka210.11.12.33 mykafka3 [root@localhost ~]# ca ...

  3. SQL基础(1)

    1.SQL简介 (1)什么是SQL? SQL指结构化查询语言 SQL使我们有能力访问数据库 SQL是一种 ANSI 的标准计算机语言 (2)SQL 能做什么? SQL面向数据库执行查询 SQL可从数据 ...

  4. CTF中常见文件的文件头(十六进制)

    jpg/jpeg FF D8 FF E0 或 FF D8 FF E1 或 FF D8 FF E8 png 89 50 4E 47 bmp 42 4D 36 5D gif 47 49 46 38 zip ...

  5. SPARC T4 RAID Setup (ZT)

    http://www.confignotes.com/2013/09/sparc-t4-raid-setup/ How to configure a RAID volume with the inte ...

  6. [原]实例-简单设计&精简代码&复用代码

    引言 本文以实际项目为例谈一谈我个人对于软件开发的理解,偏细节   软件项目B 基于.net平台,使用WPF框架,c#语言,MVVM模式开发的桌面软件 该软件支持可视化的设计器功能,允许所见即所得的方 ...

  7. OpenCV 官方工程报错(1) Couldn't load mixed_sample from loader

    openCV/OpenCV-android-sdk/samples/tutorial-2-mixedprocessing 工程 - ::): Trying to get library list - ...

  8. [poj1703]Find them, Catch them(种类并查集)

    题意:食物链的弱化版本 解题关键:种类并查集,注意向量的合成. $rank$为1代表与父亲对立,$rank$为0代表与父亲同类. #include<iostream> #include&l ...

  9. Swing事件机制

    -------------siwuxie095                             Swing 是基于 MVC 结构的框架     在 Swing 中,所有的用户操作都是基于 Co ...

  10. 时间获取_Date\SimpleDateFormat\Calendar类

     1.获取当前的日期,并把这个日期转换为指定格式的字符串,如2088-08-08 08:08:08 import java.text.SimpleDateFormat; import java.uti ...