一、检查系统是否安装了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. rosetta common sh: mpiCC command not found解决方法

    在执行多线程编译rosetta时执行: python scons.py bin mode=release extras=mpi -j8 编译安装rosetta 会出现错误sh: mpiCC comma ...

  2. Leetcode: Maximum XOR of Two Numbers in an Array

    Given a non-empty array of numbers, a0, a1, a2, - , an-1, where 0 ≤ ai < 231. Find the maximum re ...

  3. property_自己编写一个读取Property文件的Util类

    读取property文件的Util类: 所需jar包: 编写PropertiesUtil类: package com.west.util.property; import java.io.InputS ...

  4. 从NSGA到 NSGA II

    NSGA(非支配排序遗传算法).NSGAII(带精英策略的非支配排序的遗传算法),都是基于遗传算法的多目标优化算法,都是基于pareto最优解讨论的多目标优化,遗传算法已经做过笔记,下面介绍paret ...

  5. 【Arduino】使用C#实现Arduino与电脑进行串行通讯

    在给Arduino编程的时候,因为没有调试工具,经常要通过使用串口通讯的方式调用Serial.print和Serial.println输出Arduino运行过程中的相关信息,然后在电脑上用Arduin ...

  6. 介绍kali下的一些小工具

    1.macchanger 可以用来修改你的mac地址

  7. C++学习笔记(1)——数据类型占空间大小

    boolean bool 1 byte   character char 1 byte May be signed or unsigned   wchar_t 1 byte     char16_t ...

  8. UICollectionView介绍

    文章原出处未知,如有朋友知道,请告诉我,我会补上. 1.1. Collection View 全家福: UICollectionView, UITableView, NSCollectionView ...

  9. 详解 Array.prototype.slice.call(arguments)

    首先,slice有两个用法,一个是String.slice,一个是Array.slice,第一个返回的是字符串,第二个返回的是数组 在这里我们看第二个方法 1.在JS里Array是一个类 slice是 ...

  10. 关于一个新的DOM选择器querySelector

    在传统的javascript中,提到DOM选择器,大家比较熟悉的方式是通过tag,name,id来获取,其实大家都发现如果获取比较复杂的话,用这个方法会很繁琐,这时大家应该都会想到jquery里获取一 ...