Rising Sun
BlogJava
::
首頁
::
新隨筆
::
聯(lián)系
::
聚合
::
管理
::
148 隨筆 :: 0 文章 :: 22 評論 :: 0 Trackbacks
<
2013年5月
>
日
一
二
三
四
五
六
28
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(10)
給我留言
查看公開留言
查看私人留言
隨筆分類
cpp(3)
(rss)
css(6)
(rss)
hibernate+struts+spring(3)
(rss)
javascript(9)
(rss)
Lucene(3)
(rss)
oracle 數(shù)據(jù)庫(6)
(rss)
云計算(4)
(rss)
其它(6)
(rss)
處理Excel poi(6)
(rss)
學(xué)習(xí)總結(jié)(15)
(rss)
環(huán)境設(shè)置(2)
(rss)
隨筆檔案
2015年1月 (3)
2014年12月 (1)
2014年9月 (1)
2014年6月 (2)
2014年4月 (2)
2014年1月 (2)
2013年12月 (3)
2013年11月 (1)
2013年10月 (2)
2013年8月 (2)
2013年7月 (3)
2013年5月 (3)
2013年3月 (9)
2013年2月 (8)
2013年1月 (4)
2012年10月 (1)
2012年9月 (2)
2012年8月 (1)
2012年7月 (3)
2012年5月 (1)
2012年1月 (1)
2011年3月 (1)
2010年12月 (1)
2009年12月 (1)
2009年10月 (1)
2009年8月 (4)
2009年7月 (3)
2009年6月 (2)
2009年5月 (2)
2009年4月 (3)
2008年11月 (3)
2008年10月 (2)
2008年9月 (1)
2008年8月 (2)
2008年7月 (3)
2008年5月 (1)
2007年11月 (1)
2007年10月 (2)
2007年9月 (2)
2007年8月 (3)
2007年7月 (6)
2007年6月 (3)
2007年4月 (2)
2006年12月 (2)
2006年11月 (1)
2006年10月 (2)
2006年9月 (3)
2006年8月 (3)
2006年7月 (26)
2005年11月 (4)
相冊
我的相冊
java--->ajax
BlueDavy
http://www.aygfsteel.com/BlueDavy/
css
css
eamoi
搜索
最新評論
1.?re: request.getParameterValues與request.getParameter的區(qū)別:
5+5+
--5465
2.?re: 關(guān)于filter驗證用戶權(quán)限
333
--12
3.?re: Gson通過借助TypeToken獲取泛型參數(shù)的類型的方法
博主如果解決了樓上的問題 請聯(lián)系我 萬分感謝 聯(lián)系方式QQ 474233979
--yueguangxuanyuan
4.?re: Gson通過借助TypeToken獲取泛型參數(shù)的類型的方法
評論內(nèi)容較長,點擊標(biāo)題查看
--yueguangxuanyuan
5.?re: CMS,全稱Concurrent Low Pause Collector gc[未登錄]
很有用。非常感謝!?。。?
--匿名
閱讀排行榜
1.?Gson通過借助TypeToken獲取泛型參數(shù)的類型的方法(42682)
2.?304 Not Modified狀態(tài)碼(18909)
3.?電腦非法關(guān)機 導(dǎo)致ORA-01033:解決方法(9095)
4.?struts2 -- interceptor(如何配置Interceptor) (7517)
5.?MYSQL在默認的情況下查詢是不區(qū)分大小寫的(7361)
評論排行榜
1.?Gson通過借助TypeToken獲取泛型參數(shù)的類型的方法(6)
2.?Busy Developers' Guide to HSSF Features (說明書)(3)
3.?對于網(wǎng)上看到Window.Open()傳值(3)
4.?excel 處理 Poi(1)
5.?關(guān)于filter驗證用戶權(quán)限(1)
哥把Tengine改回NGINX
http://vc.hsly0559.cn/c/20111216_957.html
首先,馬云坑到了很多錢。。。所以確實有一批大神在為他干活
其次,現(xiàn)在阿里系出來又是出書又是演講跳大神裝B。。不是牛人。。給我的感覺。。跳梁小丑一樣,給后端的牛人抹黑,我實在看不習(xí)慣
第三,最近關(guān)于Tengine的討論很火,簡單看了下,在大流量下確實表現(xiàn)不錯,而且據(jù)說可以過濾掉一些攻擊或類似攻擊流量,這是其宣稱的特性,也是我們要保留的。
最后,加上了substitutions和nginx-accesskey這兩個模塊,前一個可用在垃圾站建設(shè)、過濾網(wǎng)頁非法信息上,后一個可以做防盜鏈,非常適合個人站長用。
下面來說改動和安裝過程,以centos 6 x64為基礎(chǔ)環(huán)境演示, 在/root/soft下載文件和修改文件、編譯安裝
mkdir /root/soft
cd /root/soft
首先安裝依賴包:
yum -y --noplugins install wget zip
yum -y --noplugins install unzip
yum -y --noplugins install gcc
yum -y --noplugins install make
yum -y --noplugins install pcre-devel
yum -y --noplugins install openssl-devel
yum -y --noplugins install gcc-c++
yum -y --noplugins install curl-devel
yum install -y -y subversion (SVN,從GG CODE下載substitutions
源碼
要用)
其次下載所需要的安裝文件
下載Tengine
wget -c http://tengine.taobao.org/download/tengine-1.2.0.tar.gz
下載Nginx-accesskey
wget -c http://wiki.nginx.org/images/5/51/Nginx-accesskey-2.0.3.tar.gz
下載substitutions
svn checkout http://substitutions4nginx.googlecode.com/svn/trunk/ substitutions4nginx-read-only
然后解壓tengine和nginx-access
tar zxvf tengine-1.2.0.tar.gz
tar zxvf Nginx-accesskey-2.0.3.tar.gz
解壓后,進入tengine目錄
cd tengine
root@localhost tengine]# pwd
/root/soft/cloud/tengine
[root@localhost tengine]#
開始編輯nginx.h,nginx版本號和tengine的版本號都放在這個文件里
vi src/core/nginx./*
[code]
* Copyright (C) Igor Sysoev
*/
#ifndef _NGINX_H_INCLUDED_
#define _NGINX_H_INCLUDED_
#define nginx_version 1000010
#define NGINX_VERSION "1.0.10" /* NGINX的版本號,最好別更改,更改了的話一會要改 substitutions的
源碼
,我這里是改了的,所以等下我去改substitutions /*
#define NGINX_VER "nginx/" NGINX_VERSION
/*
#define tengine_version 1002001
#define TENGINE_VERSION "1.2.1"
#define TENGINE_VER "Tengine/" TENGINE_VERSION
這里是tengine的版本號了。。我選擇全部注釋掉*/
#define NGINX_VAR "NGINX"
#define NGX_OLDPID_EXT ".oldbin"
#endif /* _NGINX_H_INCLUDED_ */h
[/code]
保存后繼續(xù)修改src/http/ngx_http_special_response.c 這個子程序在響應(yīng)用戶的http請求的時候,會反饋tengine的信息。。所以要
vi src/http/ngx_http_special_response.c
[code]
static u_char ngx_http_server_info_tail[] =
"</td>" CRLF
"</tr>" CRLF
"</table>" CRLF
;
static u_char ngx_http_error_full_tail[] =
"<hr/>Powered by " TENGINE_VER CRLF
"</body>" CRLF
"</html>" CRLF
;
static u_char ngx_http_error_tail[] =
"<hr/>Powered by Tengine" CRLF
"</body>" CRLF
"</html>" CRLF
[/code]
把里面的“TENGINE_VER CRLF”改成"NGINX_VER CRLF" 和"Powered by Tengine" 改成"Powered by NGINX"或者其他任意你想改的
再來看
src/http/ngx_http_header_filter_module.c這個文件
vi src/http/ngx_http_header_filter_module.c
[code]
static char ngx_http_server_string[] = "Server: Tengine" CRLF;
static char ngx_http_server_full_string[] = "Server: " TENGINE_VER CRLF;
[/code]
這個大家還是知道怎么改的吧。。。Server:隨便你自己定義什么了。。。TENGINE_VER 還是改會NGINX_VER吧
改到這里之后。。。
TENGINE是改完了。。。其實。。直接用sed批量就可以改了。。。不過自從上次我用sed因為正則寫錯發(fā)生悲劇后(所有/etc/*.conf的文件都里面的空格都給我給去掉了。。。)所以這次我還是很低調(diào)的一個個改。。。而且要改的文件不多。
到這里了,如果您之前沒有改nginx的版本號的話,那么你可以直接按照如下操作編譯安裝了。
./configure --prefix=/usr/local/cloud --user=cloud --group=cloud --with-poll_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_concat_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_sysguard_module --with-http_stub_status_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-backtrace_module --add-module=../../substitutions4nginx-read-only --add-module=../../nginx-accesskey-2.0.3
make&&make install
運行完畢后nginx安裝在/usr/local/cloud下
然后添加NGINX運行的用戶和用戶組
groupadd cloud
useradd -d /dev/null -s /sbin/nologin -g cloud cloud
然后chown -R cloud:cloud /usr/local/cloud
再直接啟動nginx
/usr/local/cloud/nginx
這里不附送nginx 服務(wù)啟動腳本。。
如果您在上面的nginx.h改了nginx版本的話,那么你還需要更改/root/soft/substitutions4nginx-read-only/ngx_http_subs_filter_module.c這個文件,里面有判斷nginx版本的代碼
vi /root/soft/substitutions4nginx-read-only/ngx_http_subs_filter_module.c
從1264行
[code]
#if defined(nginx_version) && nginx_version >= 8025
ngx_regex_compile_t rc;
rc.pattern = pair->match;
rc.pool = cf->pool;
rc.err = err;
rc.options = options;
if (ngx_regex_compile(&rc) != NGX_OK) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V", &rc.err);
return NGX_ERROR;
}
pair->match_regex = rc.regex;
#else
pair->match_regex = ngx_regex_compile(&pair->match,
options, cf->pool, &err);
#endif
[/code]
把if else endif注釋掉
注釋后如下
[code]
/* #if defined(nginx_version) && nginx_version >= 8025 */
ngx_regex_compile_t rc;
rc.pattern = pair->match;
rc.pool = cf->pool;
rc.err = err;
rc.options = options;
if (ngx_regex_compile(&rc) != NGX_OK) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V", &rc.err);
return NGX_ERROR;
}
pair->match_regex = rc.regex;
/*#else
pair->match_regex = ngx_regex_compile(&pair->match,
options, cf->pool, &err);
#endif */
[/code]
保存后回到編譯安裝即可。。。。
到此結(jié)束。。。
posted on 2013-05-16 16:54
brock
閱讀(328)
評論(0)
編輯
收藏
所屬分類:
學(xué)習(xí)總結(jié)
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關(guān)文章:
在同一臺機器上安裝多個版本jdk,修改環(huán)境變量不生效
Calendar.getInstance() 不要放在循環(huán)里 當(dāng)心OutOfMemoryError: Java heap space
lucene空間索引
java 獲取cpu 使用率
java 注冊到 windows 服務(wù)
哥把Tengine改回NGINX
關(guān)于產(chǎn)品經(jīng)理的四點思考
Servlet生命周期
【Spring】IOC核心源碼學(xué)習(xí)(二):容器初始化過程
Spring IOC核心源碼學(xué)習(xí)(一)
Powered by:
BlogJava
Copyright © brock
主站蜘蛛池模板:
大新县
|
泉州市
|
新津县
|
宜兰县
|
承德市
|
金湖县
|
斗六市
|
海宁市
|
中方县
|
万盛区
|
哈巴河县
|
隆林
|
眉山市
|
贵阳市
|
陆河县
|
万盛区
|
峡江县
|
土默特左旗
|
香格里拉县
|
买车
|
泸水县
|
青州市
|
武强县
|
泾川县
|
台中市
|
岳阳市
|
喀喇沁旗
|
楚雄市
|
巴彦淖尔市
|
泾川县
|
湘潭市
|
财经
|
武宣县
|
鄂伦春自治旗
|
昌都县
|
搜索
|
昌图县
|
大邑县
|
卓尼县
|
澳门
|
壤塘县
|