实际上,这个概念前段时间被炒的很热乎,不过那时候自己没有太关注Ngixn,也就没太在意,现在自己碰到了,就留意了一下。
我之前较早的nginx配置方案里面,做了文件系统检查(当初只是为了节约资源让Nginx来判断文件存在否,这样不把不存在的文件交给FastCGI来解析,能减轻FastCGI的负担,没想到意外的阻止了cgi.fix_pathinfo漏洞,真是一个惊喜!
#不存在的文件返回404
if (!-e $request_filename) {
return 404;
}
阅读全文...
请参考 Nginx Wiki http://wiki.nginx.org/NginxHttpSslModule
生成证书
$ cd /usr/local/nginx/conf
$ openssl genrsa -des3 -out server.key 1024
$ openssl req -new -key server.key -out server.csr
$ cp server.key server.key.org
$ openssl rsa -in server.key.org -out server.key
$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
编辑 nginx.conf
server {
server_name YOUR_DOMAINNAME_HERE;
listen 443;
ssl on;
ssl_certificate /usr/local/nginx/conf/server.crt;
ssl_certificate_key /usr/local/nginx/conf/server.key;
}
OK, 完成了。但这样证书是不被信任的,自己玩玩还行,要被信任请看下面。
阅读全文...
最近总感觉博客打开速度慢了不少,于是给博客做了一个优化,结果发现是Super Cache的原因。
做如下设置:
1.恢复WP Super Cache默认设置,然后再重新开启。
2.转到高级选项标签,将缓存过期时间设置为0(类似于Z-Blog那种生成静态页面了,而且没有到期时间,前提条件你的网站空间要足够大)
勾选Cache hits to this website for quick access. (Recommended)
选择Use PHP to serve cache files
勾选Compress pages so they’re served more quickly to visitors. (Recommended)
勾选Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated. (Recommended)
加入你想要移动设备支持,如手机访问的缓存则勾选Mobile device support
3.转到Preload标签,开启Preload mode模式,并点击Preload Cache Now。开始生成静态HTML缓存,这里需要耗费比较大的系统资源和时间。
4.查看Super Cache是否成功生效了。查看FTP里/cache/supercache/下各个文件夹是否有html生成,并查看源码底部是否有<!—super cache–>字样。如果都有,说明Super Cache成功开启了。
另外删除了Akismet的冗余数据。
现在博客速度很快了。
#################################################################
# Application Info:
# Name: Nginx
# Tested on nginx 0.8.35
# Nginx 0.8.36 and higher is not vulnerable
#################################################################
# Vulnerability Info:
# Type: Remote File Disclosure
# Risk: High
#################################################################
# Vulnerability:
# http://localhost/file.php%20
#################################################################
# Discoverd By: Pouya Daneshmand
# Website: http://Pouya.Securitylab.ir
# Contacts: whh_iran[at]securitylab.ir & info@securitylab[dot]ir
###################################################################
PS:其实10年前就爆出了这个漏洞,如今流传开了,估计能引起一场小小的革命,不少大站的源码都要流传出来了。
PHP PATH_INFO 存在漏洞
使用nginx+php组建的网站只要允许上传图片就可能被黑客入侵,直到5.21日凌晨,nginx尚未发布修复该漏洞的补丁;已经有一些网站被黑了,管理员速修复!
测试方法:
Nginx的服务器上传图片访问图片地址,后面加上4shell.php
例如:www.xx.com/upload/201005219527.jpg/4shell.php
临时修补方法,可3选其一
阅读全文...
最佳方法在nginx.conf加入
http{
...
server_name_in_redirect off;
...
}
国内搜索到两种方法
第一种方法 用rewrite补上/
if (-d $request_filename){ rewrite ^/(.*)([^/])$ /$1$2/ permanent; }
阅读全文...
受影响系统:
Igor Sysoev nginx 0.8.x
Igor Sysoev nginx 0.7.x
Igor Sysoev nginx 0.6.x
Igor Sysoev nginx 0.5.x
描述:
nginx是多平台的HTTP服务器和邮件代理服务器。
nginx对解析过的域名维护一个内部的DNS缓存,但在搜素缓存时,nginx仅检查名称的crc32是否匹配以及短名称是长名称的前缀,但没有检查名称的长度是否相等。如果nginx配置为代理缓存的话,远程攻击者就可以通过DNS投毒攻击欺骗域名,诱骗用户相信所访问的域名为合法。
阅读全文...
location ~ \.php$ {
proxy_cache none;
#或者是proxy_cache off ;
}
注意:0.7.59不能设置为proxy_cache none;只能proxy_cache off;
ngnix很强大:
proxy_cache_path /home/web/cache levels=1:2 keys_zone=BAOZ:100m inactive=50m max_size=20m;
阅读全文...
nginx(发音同 engine x)是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,并在一个 BSD-like 协议下发行。由俄罗斯的程序设计师Igor Sysoev所开发,最初供俄国大型的入口网站及搜寻引擎Rambler(俄文:Рамблер)使用。其特点是占有内存少,并发能力强,事实上 nginx的并发能力确实在同类型的网页伺服器中表现较好。目前中国大陆使用nginx网站用户有:新浪、网易、腾讯,另外知名的微网志Plurk也使用 nginx。
http://sysoev.ru/nginx/nginx-0.8.9.tar.gz(linux)
http://sysoev.ru/nginx/nginx-0.8.9.zip (win)
Changes with nginx 0.8.9 17 Aug 2009
*) Feature: now the start cache loader runs in a separate process; this
should improve large caches handling.
*) Feature: now temporarily files and permanent storage area may reside
at different file systems.
近期评论