{ yeah : 必须哒 } No place to place should record our youth?

3Mar/110

Support NginxWiki-20110303.chm to download

Posted by alacner

Nginx more and more popular, but official wiki have too much time to chm[NginxWiki-20090731.chm], so I compiled the latest sync to the wiki into chm, available to the offline-read students who needed.

Download:
NginxWiki-20110303.chm.tar.gz

10Dec/100

解决Nginx编译出错:cc1: warnings being treated as errors

Posted by ofeng

这个就是说如果有警告,也认为是错误,解决办法就是去掉objs/makefile中 -Werror这样一段,重新make就ok了,特记之。

Tagged as: , , , No Comments
8Sep/100

nginx/apache 中防止绑定别人恶意解析过来的域名

Posted by ofeng

转至:http://salogs.com/2010/01/nginxapache-%E4%B8%AD%E9%98%B2%E6%AD%A2%E7%BB%91%E5%AE%9A%E5%88%AB%E4%BA%BA%E6%81%B6%E6%84%8F%E8%A7%A3%E6%9E%90%E8%BF%87%E6%9D%A5%E7%9A%84%E5%9F%9F%E5%90%8D/

 

最近为了符合国家某某部门的需求,需要禁止别人而已解析非本站的域名到本站,需要做一些域名绑定的操作,故对公司各个项目做了域名绑定处理。

nginx

server {
    listen 80 default;
    root /dev/null;
    location / {
return 404;
        access_log off;
}
}

apache

# vhost.conf

<Virtualhost *:80>
ServerName  joinus.jobkoo.com
ServerAlias wanmei.jobkoo.com,test.jobkoo.com,*.jobkoo.com
  RewriteEngine on
# 只要不是下面列出的域名均报错指向error.html文件,这个文件并不存在,因此会报404
# 错误。正好符合国家要求
  RewriteCond %{HTTP_HOST} !^joinus|wanmei|test|demo\.jobkoo\.com [NC]
  RewriteRule ^/(.*) /error.html [L]
# 判断Port是否为443,不是的话跳转到443端口
  RewriteCond %{SERVER_PORT} !^443$
  RewriteRule ^/?(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
DocumentRoot "/data/web/www"
</VirtualHost>

检测是否配置成功

curl –I  domain

30Aug/100

Nginx+php下用Content-Length替换chunk编码模式方法

Posted by ofeng

1.修改nginx配置文件,gzip:off

2.php程序文件中,输出时加一个头参数

Header(“Content-lenth: $output_length\r\n”);

3.搞定!

没看过Nginx的源码,猜想了下Nginx的处理流程

   1: if( gzip on ){

   2:     chunk;

   3: }

   4: else {

   5:     if( has content-lenth ) {

   6:         content-lenth;

   7:     }

   8:     else {

   9:         chunk

  10:     }

  11: }