一.基本环境

  nginx 1.9版以后增加了一些新的特性,支持tcp负载均衡,不过这次还是用1.8.0,这里面有个memcached的代理模块,有时间再测试下

1.centos6.6

2.nginx1.8.0.tar.gz

二.安装

nginx缺省模块

--without-select_module   disable select module    #用来支持select模型
--without-poll_module     disable poll module        #用来支持poll模型
--without-http_charset_module   disable ngx_http_charset_module  #用来支持各种编码模块
--without-http_gzip_module  disable ngx_http_gzip_module       #用来支持压缩的模块
--without-http_ssi_module    disable ngx_http_ssi_module     
--without-http_userid_module  disable ngx_http_userid_module
--without-http_access_module  disable ngx_http_access_module
--without-http_auth_basic_module  disable ngx_http_auth_basic_module    #支持基本验证的模块
--without-http_autoindex_module  disable ngx_http_autoindex_module
--without-http_geo_module  disable ngx_http_geo_module
--without-http_map_module  disable ngx_http_map_module
--without-http_split_clients_module  disable ngx_http_split_clients_module
--without-http_referer_module   disable ngx_http_referer_module         #通过referer可验证来源地址是否一致
--without-http_rewrite_module  disable ngx_http_rewrite_module         #重写模块
--without-http_proxy_module  disable ngx_http_proxy_module           #反向代理模块
--without-http_fastcgi_module  disable ngx_http_fastcgi_module           #用来支持fastcgi
--without-http_uwsgi_module  disable ngx_http_uwsgi_module            #用来支持uwsgi
--without-http_scgi_module  disable ngx_http_scgi_module               #用来支持scgi

--without-http_memcached_module  disable ngx_http_memcached_module    #memcached代理模块
--without-http_limit_conn_module  disable ngx_http_limit_conn_module      #用来限制连接数的模块
--without-http_limit_req_module  disable ngx_http_limit_req_module         #用来限制请求数的模块
--without-http_empty_gif_module disable ngx_http_empty_gif_module       #用来生成一张1x1的空白图片,可用来传递参数
--without-http_browser_module  disable ngx_http_browser_module   #用来匹配浏览器头部的模块
--without-http_upstream_hash_module     disable ngx_http_upstream_hash_module    #根据hash算法负载均衡
--without-http_upstream_ip_hash_module   disable ngx_http_upstream_ip_hash_module   #根据ip hash算法负载均衡
--without-http_upstream_least_conn_module  disable ngx_http_upstream_least_conn_module   #最少连接数负载均衡
--without-http_upstream_keepalive_module   disable ngx_http_upstream_keepalive_module   #用来支持长连接的模块,也就是连接复用
--without-http   disable HTTP server     #用来支持http服务器的模块
--without-http-cache   disable HTTP cache   #用来支持http缓存的模块
--without-mail_pop3_module disable ngx_mail_pop3_module    #用来支持代理邮件pop3收件协议的模块
--without-mail_imap_module disable ngx_mail_imap_module  #用来支持代理邮件imap收件协议的模块
--without-mail_smtp_module  disable ngx_mail_smtp_module  #用来支持代理邮件smtp发件协议的模块
--without-pcre  disable PCRE library usage    #用来支持正则的模块

#现在选取几个常用的模块 nginx状态监控和一个ssl模块

$ yum install -y wget pcre pcre-devel zlib zlib-devel openssl openssl-devel
$ useradd nginx -s /sbin/nologin -M
$ ./configure --prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_stub_status_module
--with-http_ssl_module $ make && make install
$ ln -s /usr/local/nginx/sbin/nginx /usr/sbin/
$ ln -s /usr/local/nginx/conf /etc/nginx

  

  

三.配置

$ touch /etc/init.d/nginx
$ chmod 755 /etc/init.d/nginx
$ vi /etc/init.d/nginx
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/usr/local/nginx/logs/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
echo "nginx already running...."
exit 1
fi
echo -n $"Starting $prog: "
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
return $RETVAL
}
# Stop nginx daemons functions.
stop() {
echo -n $"Stopping $prog: "
killproc $nginxd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /usr/local/nginx/logs/nginx.pid
}
reload() {
echo -n $"Reloading $prog: "
#kill -HUP `cat ${nginx_pid}`
killproc $nginxd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;; status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
exit 1
esac
exit $RETVAL

  

四.启动

 /etc/init.d/nginx start

五.检查

结束!!!!

Centos6.6 编译安装nginx的更多相关文章

  1. Centos6.4 编译安装 nginx php

    一. 准备依赖库 安装make: yum -y install gcc automake autoconf libtool make 安装g++: yum install gcc gcc-c++ 二. ...

  2. CentOS6.5 编译安装Nginx

    一.准备编译环境 1. 系统为centos6.5最小安装,关闭selinux,关闭防火墙. 2. 安装编译工具 # yum -y install gcc gcc-c++ autoconf automa ...

  3. centos6.9编译安装nginx

    1.安装nginx所需的依赖包: yum -y install gcc gcc-c++ autoconf automake  zlib zlib-devel openssl openssl-devel ...

  4. centos6.5编译安装nginx

    系统64位 centos6.5 nginx官网:http://nginx.org/ 下载nginx源码包: wget  http://nginx.org/download/nginx-1.6.2.ta ...

  5. 【转】linux 编译安装nginx,配置自启动脚本

    linux 编译安装nginx,配置自启动脚本 本文章来给各位同学介绍一篇关于linux 编译安装nginx,配置自启动脚本教程,希望有需要了解的朋友可一起来学习学习哦. 在公司的suse服务器装ng ...

  6. linux 编译安装nginx,配置自启动脚本

    本文章来给各位同学介绍一篇关于linux 编译安装nginx,配置自启动脚本教程,希望有需要了解的朋友可一起来学习学习哦. 在公司的suse服务器装nginx,记录下安装过程: 参照这篇文章:Linu ...

  7. Linux.Centos6编译安装nginx

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

  8. CentOS6.6 32位 Minimal版本纯编译安装Nginx Mysql PHP Memcached

    声明:部分编译指令在博客编辑器里好像被处理了,如双横线变成单横线了等等,于是在本地生成了一个pdf版本,在下面地址可以下载. LNMP+Memcached CentOS是红帽发行的免费的稳定Linux ...

  9. CentOS6.3编译安装Nginx1.4.7 + MySQL5.5.25a + PHP5.3.28

    [准备工作] #在编译安装lnmp之前,首先先卸载已存在的rpm包. rpm -e httpd rpm -e mysql rpm -e php yum -y remove httpd yum -y r ...

随机推荐

  1. SGC强制最低128位加密,公钥支持ECC加密算法的SSL证书

      Pro SSL证书,验证企业域名所有权和企业身份信息,采用SGC(服务器门控)技术强制128位以上至256位加密,属于企业OV验证级专业版(Pro) SSL证书:即使用户使用低版本浏览器(比如浏览 ...

  2. Codeforces Round #413(Div. 1 + Div. 2, combined)——ABCD

    题目在这里 A.Carrot Cakes 乱七八糟算出两个时间比较一下就行了 又臭又长仅供参考 #include <bits/stdc++.h> #define rep(i, j, k) ...

  3. 选择客栈(codevs 1135)

    题目描述 丽江河边有n 家很有特色的客栈,客栈按照其位置顺序从 1 到n 编号.每家客栈都按照某一种色调进行装饰(总共 k 种,用整数 0 ~ k-1 表示),且每家客栈都设有一家咖啡店,每家咖啡店均 ...

  4. Configuration must specify a spooling directory

    启动spooling源时报错: 原因:spooling配置文件有误 a1.sources.r1.type = spooldir a1.sources.r1.spooldir = /usr/local/ ...

  5. hdu_2054_A == B_201311301601

    A == B ? Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total S ...

  6. Spring MVC 入门(一)

    什么是 Spring MVC 学习某一样东西之前,我们一定要大致知道这个东西是什么,能干什么,为什么要用它. Spring MVC 是一个开源平台,一个基于 Spring 的 MVC 框架,它支持基于 ...

  7. PHP array_intersect_key()

    定义和用法 array_intersect_key() 函数使用键名比较计算数组的交集. array_intersect_key() 返回一个数组,该数组包含了所有出现在被比较的数组中并同时出现在所有 ...

  8. Apache OFbiz service engine 源代码解读

    上一篇看完了ofbiz entity engine,这篇再来过一下ofbiz的service engine.service engine层在设计模式的使用上跟entity engine有些相似,最典型 ...

  9. Criteria——Hibernate的面向对象查询

    提到Hibernate的查询.我们往往会想到HQL,他使我们的SQL语句面向对象话. 事实上细看,差点儿相同就是把SQL语句中的表和字段用所相应的实体和属性给取代了.事实上.Hibernate中还有还 ...

  10. pascal+sublime搭建Pascal学习环境

    一.fpc安装 1. 下载:http://www.freepascal.org/down/i386/win32.var(或者:http://download.csdn.net/detail/wenph ...