本地嘗試tengine系統部署,虛擬機,Ubuntu系統;html
1,wget http://tengine.taobao.org/download/tengine-2.1.0.tar.gz nginx
2,安裝pcre,sslweb
sudo apt-get install libpcre3 libpcre3-dev sudo apt-get install openssl libssl-dev
3,僞造server頭:shell
nginx.conf,http塊內添加ubuntu
server_tag Apache/2.2.21; #Server頭癿假裝 server_tag off #隱藏server頭部
修改文件src/core/nginx.htomcat
#define TENGINE "your server name" #define tengine_version 2001000 #define TENGINE_VERSION "server version" #define TENGINE_VER TENGINE
隱藏server頭:url
http://tengine.taobao.org/document_cn/core_cn.htmlspa
3,編譯,安裝.net
$ ./configure --prefix=/home/test/source/tengine $ make $ sudo make install
4,運行code
@ubuntu:/usr/local/nginx/sbin$ sudo ./nginx
5,配置https
經過openssl生成自定義私鑰,修改nginx.conf
# HTTPS server server { server_name localhost; listen 443; ssl on; ssl_certificate /usr/local/nginx/conf/server.crt; ssl_certificate_key /usr/local/nginx/conf/server.key;
訪問顯示證書未通過驗證
須要付費驗證證書,免費渠道http://www.startssl.com,待須要的時候嘗試。
6,局部反爬蟲:
http://www.abc3210.com/2013/web_04/82.shtml
http://my.oschina.net/kone/blog/88690
7,防止客戶繞過nginx訪問tomcat
iptable,防火牆關閉tomcat端口;或者tomcat綁定127.0.0.1
<Connector port= "8080" address= "127.0.0.1" maxHttpHeaderSize= "8192" maxThreads="150" minSpareThreads= "25" maxSpareThreads= "75" enableLookups="false" redirectPort= "8443" acceptCount= "100" connectionTimeout="20000" disableUploadTimeout= "true" URIEncoding="UTF-8" />