出处: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. Java-API:java.io百科

    ylbtech-Java-API:java.io百科 Java的核心库java.io提供了全面的IO接口.包括:文件读写.标准设备输出等.Java中IO是以流为基础进行输入输出的,所有数据被串行化写入 ...

  2. eclipse插件安装(个人版)

    1.Eclipse 安装反编译插件jadclipse http://jingyan.baidu.com/article/3f16e003c857082590c1036f.html 2.MyEclips ...

  3. 某个应用使cpu使用率100%

    --CPU使用率 Linux是一个多任务的操作系统,将每个cpu的时间划分为很短的时间片,再通过调度器轮流分配给各个任务使用,因此造成多任务同时运行的错觉 为了维护cpu时间,linux通过事先定义的 ...

  4. I/O---读取txt文件----demo

    首先获得一个文件句柄.File file = new File(); file即为文件句柄. 读取甲方的信息:new FileInputStream(file) 目前这个信息已经读进来内存当中了.接下 ...

  5. c#在sql中存取图片image示例

    这篇文章主要介绍了c#在sql中存取图片image示例,需要的朋友可以参考下 (1)控制台应用程序下演示插入图片 复制代码 代码如下: public void InsertIMG() { //将需要存 ...

  6. windows cmd for paramiko

    wmic cpu get LoadPercentage wmic memphysical list brief wmic memphysical  get MaxCapacity   主板芯片组支持最 ...

  7. Solaris10 如何设置空闲ssh连接超时断开

    在ssh的配置文件中有2个参数可以控制空闲连接超时断开.这2个参数是ClientAliveCountMax和ClientAliveInterval. Solaris10上设置空闲ssh连接超时断开的方 ...

  8. Firefox切换页面默认显示语言

    重新安装了下Firefox,发现页面语言变为中文,而我的有些脚本是在英文界面录的,因此想把默认语言改为英文. 方法如下: 工具 - 选项 - 语言(选择...),将英文上移到顶部 在做上面的修改之前, ...

  9. struts1.2里的ActionMessages的使用

    转自:https://blog.csdn.net/oswin_jiang/article/details/4582187

  10. 用java代码解决10元喝多少瓶汽水的问题

    问题:汽水2元一瓶,四个盖子换一瓶,两个空瓶一瓶,问10元可以喝几瓶?(不许借别人空瓶或瓶盖,但可以先喝汽水再付空酒瓶或瓶盖) 最近同事让笔者看了一道脑筋急转弯的数学题,当然不是很难,只要会加减法应该 ...