一般使用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. poj 3295 Tautology

    点击打开链接 Tautology Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8127   Accepted: 3115 ...

  2. SQL备份表及相关笔记

    create table history1301( remark nvarchar(64))create table history1302( remark nvarchar(64))create t ...

  3. What is the Database Initialization Parameter That is Associated to an ORA-32004 Error ?

    APPLIES TO: Oracle Database - Enterprise Edition - Version 9.2.0.1 to 11.2.0.3 [Release 9.2 to 11.2] ...

  4. Kafka单机版环境搭建

    使用版本:kafka_2.10-0.8.1.1 安装: -0.8.1.1.tgz -C ~/app/ 添加环境变量:.bash_profile export KAFKA_HOME=/home/spar ...

  5. JS浮点数运算BUG破法

    JS里,0.3*3 = 0.8999999999999999 破法1:((0.3*10)*3)/10 破法2:(0.3*3).toFixed(2)//保留两位小数 原因:js浮点数用的是IEEE754 ...

  6. http是什么?

    http HyperText Transfer Protocol 超文本传输协议,是一个应用层通信协议. 可以用wireshark抓取.

  7. LoadRunner界面分析(一)

    1.Virtual User Generator 2.新建脚本的方式 3.Task模式 4.Recording Options选项 5.Run-Time setting选项

  8. Gradle用户指南(章9:Groovy快速入门)

    Gradle用户指南(章9:Groovy快速入门) 你可以使用groovy插件来构建groovy项目.这个插件继承了java插件的功能,且扩展了groovy编译.你的项目可以包含groovy代码.ja ...

  9. 【测试】自行建表并演示append+nologging,并描述数据写入后产生的效果

    ①创建表: SQL> create table t4 as select * from all_objects; Table created. ②设置t4处于nologging: SQL> ...

  10. math对象和date对象

    math对象的函数方法,记住Math首字母要大写 console.log(Math.abs(-5)); //取绝对值 console.log(Math.ceil(1.1)); //向上取舍 conso ...