出处: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. centos6 安装teamviewer

    wget http://www.teamviewer.com/download/teamviewer_linux.rpm yum -y install temviewerX.rpm 机器最好联网,能够 ...

  2. opencv相关

    http://opencv.org/ ================== 不错的博客: 图像处理(小魏的修行路):http://blog.csdn.net/xiaowei_cqu/article/c ...

  3. java之类的封装

    类和对象成员变量,成员函数特殊的成员变量和成员函数 函数重载 构造函数 静态变量 静态函数面向对象:封装 继承 多态封装 Encapsulation为什么需要封装?外界无法直接操作对象的具体的属性(安 ...

  4. springmvc 注解式开发 接收请求参数

    1.校正请求参数名: 2.以对象形式整体接收 3.路径变量:

  5. Switch/Case 的穿透性

    /*键盘录入1到12 ,对应输出该月份对应的季节 .如果输入的不是1到12,输出提示信息:您输入的数据有误. PS: 春季:3,4,5月份 夏季: 6,7,8月份 秋季: 9,10,11月份 冬季:1 ...

  6. Python 网络爬虫 007 (编程) 通过网站地图爬取目标站点的所有网页

    通过网站地图爬取目标站点的所有网页 使用的系统:Windows 10 64位 Python 语言版本:Python 2.7.10 V 使用的编程 Python 的集成开发环境:PyCharm 2016 ...

  7. Luogu 1314 [NOIP2011] 聪明的质监员

    二分答案 + 前缀和. 题面中式子的意思是每一个区间$[l, r]$的贡献是这个区间内$w_i \geq W$的个数乘以这些$i$的$v_i$和. 很快发现了答案具有单调性,可以做两遍二分,分别看看小 ...

  8. Entity Framework Tutorial Basics(31):Migration from EF 4.X

    Migration from Entity Framework 4.1/4.3 to Entity Framework 5.0/6.0 To migrate your existing Entity ...

  9. windows7向github提交代码

    首先要有一个github账号. 我自己申请了github账号,然后创建一个代码仓库. 这个是我创建好的代码仓库:里面是空的没有代码,我今天从我本地写好的代码,传到github上面去. 首先需要告诉gi ...

  10. 查看Linux各发行版本方法

    SUSE: cat /etc/SuSE-release   Slackware: cat /etc/slackware-version   Redhat: cat /etc/redhat-releas ...