使用epel

[root@nginx /]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

下载nginx 1.6.3

[root@nginx /]# wget http://nginx.org/download/nginx-1.6.3.tar.gz

安装前准备

安装pcre (安装pcre库是为了Nginx支持HTTP Rewrite 模块)

[root@nginx /]# yum -y install pcre pcre-devel 

安装openssl

[root@nginx /]# yum -y install openssl openssl-devel

gcc编译器

[root@nginx /]# yum -y install gcc gcc-c++

解压

[root@nginx /]# ll nginx-1.6..tar.gz
-rw-r--r-- root root Apr nginx-1.6..tar.gz
[root@nginx /]# tar zxvf nginx-1.6..tar.gz
[root@nginx /]# cd nginx-1.6.
[root@nginx nginx-1.6.]# pwd
/nginx-1.6.

创建nginx用户

[root@nginx nginx-1.6.]# useradd nginx -s /sbin/nologin -M

配置、编译、安装

[root@nginx nginx-1.6.]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
[root@nginx nginx-1.6.]# echo $? [root@nginx nginx-1.6.]# make && make install
[root@nginx nginx-1.6.]# echo $?
0
[root@nginx nginx-1.6.3]# ln -s /usr/local/nginx/sbin/* /usr/local/sbin

启动nginx

[root@nginx nginx-1.6.]# /usr/local/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@nginx nginx-1.6.]# /usr/local/sbin/nginx
[root@nginx nginx-1.6.]# netstat -lntup | grep nginx
tcp 0.0.0.0: 0.0.0.0:* LISTEN /nginx
[root@nginx nginx-1.6.]# lsof -i :
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx root 6u IPv4 0t0 TCP *:http (LISTEN)
nginx nginx 6u IPv4 0t0 TCP *:http (LISTEN)

浏览器访问:http://192.168.161.134

关闭防火墙或修改防火墙规则

[root@nginx nginx-1.6.]# /etc/init.d/iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
root@nginx nginx-1.6.]# iptables -I INPUT -p tcp --dport  -j ACCEPT
[root@nginx nginx-1.6.]# /etc/init.d/iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables: [ OK ]

或本机测试

[root@nginx nginx-1.6.]# curl 192.168.161.134
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p> <p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p>
</body>
</html>

修改nginx.conf

[root@nginx nginx-1.6.]# cd /usr/local/nginx/conf/
[root@nginx conf]# pwd
/usr/local/nginx/conf
[root@nginx conf]# vim nginx.conf
user nginx;
worker_processes ; log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main;
sendfile on;
tcp_nopush on;
gzip on; server {
listen ;
server_name www.httpd.com; charset utf-; access_log logs/host.access.log main; location / {
root html;
index index.html index.htm;
} error_page /.html; error_page /50x.html;
location = /50x.html {
root html;
}

CentOS 6.5 安装nginx 1.6.3的更多相关文章

  1. 在CentOS 7中安装nginx服务器

    简要地介绍一下,如何在CentOS 7中安装nginx服务器  下载对应当前系统版本的nginx包(package) # wget  http://nginx.org/packages/centos/ ...

  2. Linux系统运维笔记(四),CentOS 6.4安装Nginx

    Linux系统运维笔记(四),CentOS 6.4安装Nginx 1,安装编译工具及库文件 yum -y install make zlib zlib-devel gcc-c++ libtool op ...

  3. 如何在 CentOS 7 上安装 Nginx

    本文首发:开发指南:如何在 CentOS 7 上安装 Nginx Nginx 读作 engine x, 是一个免费的.开源的.高性能的 HTTP 和反向代理服务,主要负责负载一些访问量比较大的站点. ...

  4. CentOS 7 源代码安装Nginx

    本篇简要介绍CentOS 7 源代码安装Nginx. Preface # yum install epel-release -y # yum group install "Developme ...

  5. Centos 7下安装nginx,使用yum install nginx,提示没有可用的软件包

    Centos 7下安装nginx,使用yum install nginx,提示没有可用的软件包. 18 (flaskApi) [root@67 flaskDemo]# yum -y install n ...

  6. centos 下yum 安装nginx

    centos 下yum 安装nginx 1. 直接yum install nginx不行,要先处理下源: rpm -ivh http://nginx.org/packages/centos/6/noa ...

  7. centos直接yum安装nginx

    Ubuntu下安装nginx,直接apt-get install nginx就行了,很方便. 但是今天装了CentOS6.2,直接yum install nginx不行,要先处理下源,下面是安装完整流 ...

  8. centos系统编译安装nginx+php环境另加独立mysql教程

    以前看过的安装nginx+php环境都带了mysql数据库了,这个是因为很多站长都是nginx+php+mysql都在同一台服务器了,那么今天我们是单独处理了,一个是nginx+php环境,然后mys ...

  9. 腾讯云CentOS 6.6安装 Nginx

    一.下载Nginx 从Nginx的官网(http://nginx.org/en/download.html)下载Nginx的最新版本,这里我下载的是nginx-1.9.12. 下载完成后,得到一个如下 ...

  10. CentOS 6.5 安装Nginx 1.7.4

    一.安装准备 首先由于nginx的一些模块依赖一些lib库,所以在安装nginx之前,必须先安装这些lib库,这些依赖库主要有g++.gcc.openssl-devel.pcre-devel和zlib ...

随机推荐

  1. LAMP-五分钟搭建个人论坛

    LAMP-五分钟搭建个人论坛 系统版本:CentOS7 1.##安装lamp及依赖软件wget http://repo.mysql.com/mysql-community-release-el7-5. ...

  2. 【转载】Linux 与 BSD 有什么不同?

    原创:Linux中国 https://linux.cn/article-3186-1.html 原创:LCTT https://linux.cn/article-3186-1.html 本文地址:ht ...

  3. CF570D:Tree Requests

    传送门 DFS重标号+二分 打比赛的时候想了很多方法..DFS序,BFS序,倍增什么的都考虑了一遍,但是几乎要么是可以维护两个区间但是代码复杂度爆炸,要么就是只能维护单一维度的信息. 这道题的具体做法 ...

  4. [POJ2773]:Happy 2006

    传送门 同样是欧拉函数的基本应用. $\phi (N)$表示$[1,N]$中,$gcd(i,N)==1$的数的个数,同理,其也能表示$[K \times N+1,(K+1) \times N]$中$g ...

  5. BZOJ4653: [Noi2016]区间

    传送门 UOJ上卡掉一个点,COGS上卡掉两个点..弃疗,不改了,反正BZOJ上过啦hhh 先把区间按长度递增排序.然后每次用线段树维护区间最大覆盖次数,用一个指针随便扫扫就行了. //NOI 201 ...

  6. web前端环境搭建

    第一部分:浏览器 浏览器推荐chrome浏览器.FireFox浏览器. 1. chrome浏览器因为集成了Google Developer Tools(谷歌开发者工具),因此大受欢迎. 下载地址:ht ...

  7. BZOJ3226: [Sdoi2008]校门外的区间

    感觉很有趣的题呢. 每个点拆成两个,线段树维护. 不过这题难点其实在输入输出. #include<bits/stdc++.h> #define N (1<<17) #defin ...

  8. 【原】React中,map出来的元素添加事件无法使用

    在使用react中,经常用到react的map函数,用法和jquery里中的map一样,但是,如果你在每个map出来的元素中添加,你会发觉添加的事件无法关联, 比如,我们很多的评论,我需要在每个评论下 ...

  9. uC/OS-II时间(OS_time)块

    /*************************************************************************************************** ...

  10. MSDeploy 同步时不删除原有文件

    在 jenkins里  Execute Windows batch command "C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\m ...