一般使用linux系统的不少网友可能都是直接使用一键安装包进行安装的,以前作者也这样,但是很多时候这些一键安装方便是方便但是可能在升级及其他很多地方不是很好,本文就说下在centos6.3安装nginx1.2的步骤。

安装说明

操作系统:centos6.3

软件:nginx-1.2.6.tar.gz

安装方式:源码编码安装

安装位置:/usr/local/nginx

nginx下载地址:http://nginx.org/en/download.html

准备工具

在安装nginx衫,需要确保系统已经安装了g++、gcc、openssl-devel、pcre-devel和zlib-devel软件。

  1. yum install gcc-c++
  2. yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel

检查系统安装的ningx

  1. find -name nginx
  2. ./nginx
  3. ./nginx/sbin/nginx
  4. ./nginx-1.2.6/objs/nginx

卸载系统原有的nginx

  1. yum remove nginx

centos安装nginx

将安装包文件上传到目录中,本文是上传到/usr/local中,按以下命令进行操作。

  1. [root@admin local]# cd /usr/local
  2. [root@admin local]# tar -zxv -f nginx-1.2.6.tar.gz
  3. [root@admin local]# rm -rf nginx-1.2.6.tar.gz
  4. [root@admin local]# mv nginx-1.2.6 nginx
  5. [root@admin local]# cd /usr/local/nginx
  6. [root@admin nginx]# ./configure --prefix=/usr/local/nginx
  7. [root@admin nginx]# make
  8. [root@admin nginx]# make install

配置防火墙

配置防火墙开启80端口,不开启的话,有时防火墙会不让外网访问80端口我们就无法访问nginx配置的网站了。

  1. #修改防火墙配置:
  2. [root@admin nginx-1.2.6]# vi + /etc/sysconfig/iptables
  3. #添加配置项
  4. -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
  5. #重启防火墙
  6. [root@admin nginx-1.2.6]# service iptables restart

启用nginx命令

  1. #方法1
  2. [root@admin nginx-1.2.6]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
  3. #方法2
  4. [root@admin nginx-1.2.6]# cd /usr/local/nginx/sbin
  5. [root@admin sbin]# ./nginx

停止nginx命令

  1. #查询nginx主进程号
  2. ps -ef | grep nginx
  3. #停止进程
  4. kill -QUIT 主进程号
  5. #快速停止
  6. kill -TERM 主进程号
  7. #强制停止
  8. pkill -9 nginx

重启nginx命令

  1. [root@admin local]# /usr/local/nginx/sbin/nginx -s reload

centos6.3安装nginx的更多相关文章

  1. Centos6 下安装Nginx+Mysql+PHP

    安装nginx https://segmentfault.com/a/1190000007928556 添加源 $ wget http://nginx.org/packages/centos/6/no ...

  2. centos6.5 安装nginx

    安装之前先安装VMware tools(方便于从windows上拷贝文件到linux) 1. nginx安装环境 nginx是C语言开发,建议在linux上运行,本次使用Centos6.5作为安装环境 ...

  3. Centos6 yum安装nginx

    1.Centos6系统库中默认是没有nginx的rpn包的,所以我们需要先更新下rpm依赖库 (1):使用yum安装nginx,安装nginx库 rpm -Uvh http://nginx.org/p ...

  4. CentOS6.5安装nginx及负载均衡配置

    所有的安装包可以去以下地址下载,或者自行去官网下载,下面都有介绍. 所有安装包地址:http://download.csdn.net/detail/carboncomputer/9238037 原文地 ...

  5. Centos6.6安装Nginx

    1.在安装nginx之前,需要先安装该模块需要依赖包 yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel 2.安 ...

  6. centos6.5安装nginx+python+uwsgi+django

    nginx+uwsgi+django环境部署及测试 默认系统自带的python2.6.6 第一步(安装setuptools) wget https://pypi.python.org/packages ...

  7. CentOS6.5安装Nginx

    1.安装prce(重定向支持)和openssl(https支持,如果不需要https可以不安装.) yum -y install pcre* yum -y install openssl* 2.下载n ...

  8. Linux.Centos6编译安装nginx

    环境 系统环境:CentOS release 6.7 (Final) 需求 centos6.7编译安装nginx1.x 准备 安装依赖 yum install -y gcc gcc-c++ autoc ...

  9. CentOS-6 yum安装nginx php53 mysql55 搭建LNMP环境

    1.导入外部软件库 01.rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/epel-release-6-5.noa ...

随机推荐

  1. SQL 获取各表记录数的最快方法

    select distinct o.name,i.rows from sysobjects o,sysindexes  i where o.id=i.id and o.Xtype= 'U' and i ...

  2. Winista.Text.HtmlParser; 获取html

    using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...

  3. Rolling Cursor Invalidations with DBMS_STATS.AUTO_INVALIDATE (文档 ID 557661.1)

      Rolling Cursor Invalidations with DBMS_STATS.AUTO_INVALIDATE (文档 ID 557661.1) 转到底部 In this Documen ...

  4. namespace用法

    1.在WCF.Controller中定义了一个UserModel,标记为① 2.在WCF.Controller.Model中定义了一个UserModel(同上,namespace不同),标记为② 3. ...

  5. Functions类,一个Javascript的函数加法类,将两个函数加起来,顺序执行

    以下是类的代码: var Functions = { oFunctions: null, add: function (oFunc, oNewFunc) { var oNew = function ( ...

  6. vc调用dll 示例

    其实,调用dll文件的方法很多,不一定要使用LoadLibrary函数.如果使用的话,你就要预先声明dll中的函数,很麻烦. 下面是我使用dll时的一点技巧,就是引入lib文件,可以参考: 一.Win ...

  7. 带你快速了解CODESOFT 2015

    CODESOFT是知名的条码标签设计打印软件,现在又推出了最新版CODESOFT 2015,其新功能.大改进让人为之一振.下面跟随小编的脚步,走进CODESOFT 2015,看一看CODESOFT 2 ...

  8. Social networks and health: Communicable but not infectious

    Harvard Men’s Health Watch Poet and pastor John Donne famously proclaimed “No man is an island.” It ...

  9. [神器推荐]node-webkit:跨平台桌面web应用的神器,非常有用(转)

    11月8号在清华拍的银杏树 http://finalshares.com/read-931

  10. Change screensaver through registry

    If you wanna change the screensaver, you can update registry as follows{autoit script}: RegWrite(&qu ...