一、检查系统是否安装了Nginx

[root@localhost local]# find -name nginx
[root@localhost local]#

(如果已经安装了nginx就卸载掉原来的)

[root@localhost local]# yum remove nginx

注意:下麵是安裝依賴包(linux源碼安裝的時候需要安裝依賴包,如果安裝了就跳過)

[root@localhost /]# yum install -y gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel*

二、将安装包文件上传到/usr/local中执行以下操作

[root@localhost local]# cd /usr/local
[root@localhost local]# tar -zxv -f nginx-1.6.0.tar.gz
[root@localhost local]# rm -rf nginx-1.6.0.tar.gz
[root@localhost local]# mv nginx-1.6.0 nginx
[root@localhost local]# cd /usr/local/nginx-1.6.0
[root@localhost nginx-1.6.0]# ./configure --prefix=/usr/local/nginx
[root@localhost nginx-1.6.0]# make
[root@localhost nginx-1.6.0]# make install

提示错误时:

./configure: error: the HTTP cache module requires md5 functions

from OpenSSL library.   You can either disable the module by using

--without-http-cache option, or install the OpenSSL library into the system,

or build the OpenSSL library statically from the source with nginx by using

--with-http_ssl_module --with-openssl=<path> options.

这个因为第一次安装nginx,缺少了依赖包,需要安装:

[root@localhost nginx-1.6.0]# yum -y install pcre-devel openssl openssl-deve
....
[root@localhost nginx-1.6.0]# ./configure --prefix=/usr/local/nginx
....
[root@localhost nginx-1.6.0]#make && make install
....

三、配置

#修改防火墙配置:

[root@localhost nginx-1.6.0]# vi + /etc/sysconfig/iptables
#添加配置项
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
#重启防火墙
[root@localhost nginx-1.6.0]# service iptables restart

四、启动

#方法1
[root@localhost nginx-1.6.0]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
#方法2
[root@localhost nginx-1.6.0]# cd /usr/local/nginx/sbin
[root@localhost sbin]# ./nginx
重启:
[root@localhost local]#/usr/local/nginx/sbin/nginx -t
[root@localhost local]#/usr/local/nginx/sbin/nginx -s reload

五、测试是否安装成功

1、查看nginx的进程:

[root@localhost conf]# ps -ef | grep nginx

2、 在浏览器中输入:http://ip:端口 如果看到nginx的欢迎页面表示安装成功,如果页面大不开,请关闭防火墙继续测试
3、 关闭防火墙
(1) 重启后永久性生效:  
      开启:chkconfig iptables on  
      关闭:chkconfig iptables off  
(2) 即时生效,重启后失效: 
      开启:service iptables start  
      关闭:service iptables stop

nginx安装好后如果需要开机重启nginx请看 》》 linux下安装nginx后开机启动篇

CentOs6.5下独立安装Nginx篇的更多相关文章

  1. CentOs6.5下独立安装mysql篇

    1.安装包:Mysql: mysql-5.6.13.tar 一.源码包准备 (1)mysql-5.6.13.tar.gz 源码包.去www.mysql.com下载最新的mysql-5.6.13.tar ...

  2. Linux(CentOS6.5)下编译安装Nginx官方最新稳定版(nginx-1.10.0)

    注:此文已经更新为新版:http://comexchan.cnblogs.com/p/5815753.html ,请直接查看新版,谢谢! 本文地址http://comexchan.cnblogs.co ...

  3. centos6.7下编译安装lnmp

    很多步骤不说明了,请参照本人的centos6.7下编译安装lamp,这次的架构是nginx+php-fpm一台服务器,mysql一台服务器 (1)首先编译安装nginx: 操作命令: yum -y g ...

  4. CentOS6.5下Oracle11G-R2安装、卸载

    CentOS6.5下Oracle11G-R2安装.卸载 资源下载地址(包含本人全部安装过程中,系统备份文件):http://download.csdn.net/detail/attagain/7700 ...

  5. centos6.7下 编译安装MySQL5.7

    centos6.7下编译安装MySQL5.7 准备工作 #-----依赖包及MySQL和boost安装包----- #yum包安装: shell> yum -y install gcc-c++ ...

  6. Linux(CentOS6.5)下编译安装PHP5.6.22时报错”configure: error: ZLIB extension requires gzgets in zlib”的解决方式(确定已经编译安装Zlib,并已经指定Zlib路径)

    本文地址http://comexchan.cnblogs.com/,作者Comex Chan,尊重知识产权,转载请注明出处,谢谢!   今天在CentOS6.5下编译安装PHP时,一直报错 confi ...

  7. 在CentOS 7下编译安装Nginx+PHP+MySQL环境

    本文转载自:http://www.softeng.cn/?p=156,本文已获得作者授权,未经作者同意,不可转载. 1.前言 本文适合于已经对Linux操作系统具有基本操作经验,并且能够在Linux或 ...

  8. CentOS6.5_64bit下编译安装MySQL-5.6.23

    转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/44785511 ************************************** ...

  9. CentOS6.5下编译安装LAMP环境

    LAMP(Linux-Apache-MySQL-PHP)网站架构是目前国际流行的Web框架.该框架能够满足大流量.大并发量的网站需求:当然.也可以直接使用高性能的服务器.高性能的负载均衡硬件以及CDN ...

随机推荐

  1. Leetcode: Minimum Number of Arrows to Burst Balloons

    There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided ...

  2. 对java多线程的认识

    多线程的概念:多线程是一种机制,它允许在程序中并发的执行多个线程,且每个线程间相互独立. 实现多线程的两种方式: 1.继承java.lang.Thread类,并且重写它的run方法,将线程的执行主体放 ...

  3. tp生成验证码

    视图层: <input type="text" name="code" value="" />        <img o ...

  4. mfc ui3

    引用:http://www.cnblogs.com/rainbowzc/archive/2010/06/02/1749872.html 本文专题讨论VC中的界面美化,适用于具有中等VC水平的读者.读者 ...

  5. Qt之qt4.7 和qt 4.8.4 交叉实践

    开发机环境搭建: 测试环境:CentOs7.1  Ubuntu 12.0.4 操作流程: 一.编译Qt4.7.0 1)CentOS上实践 1.tar xzvf qt-everywhere-openso ...

  6. Excel中设置下拉列表的来源怎么选择其他工作表的内容

    我就简单的说一下 SHEET1 的A1 要引用SHEET2的a1:a2的内容 在数据有效性里面选序列 输入=INDIRECT("sheet2!a1:a2") 或者你可以按楼上的意思 ...

  7. centos6.6编译安装lnmp系列之nginx

    简介: 环境:虚拟机+centos6.6 Cmake下载地址:http://www.cmake.org/files/v3.0/cmake-3.0.2.tar.gz Nginx 下载地址: http:/ ...

  8. QT笔记之不规则窗口的实现

    QT实现的不规则窗口,是根据图片的形状显示 1.去标题栏 2.设置窗口背景为透明色 3.最后给窗口设置背景色 注:背景图为镂空的 格式为.png 图片资源下载:http://pan.baidu.com ...

  9. HDU1848 Fibonacci again and again SG函数

    Fibonacci again and again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Jav ...

  10. [jetbrains系列] 外链第三方库+代码补全设置

    jetbrains系列的IDE真的是太好用了,有种相见恨晚的感觉. 在开发过程中第三方库是必不可少的,在开发的时候如果有一个可以补全的IDE可以节省查文档的时间. 举个例子:给pycharm配pysp ...