SPIP

Recipe

server {
    server_name emeagwali.net www.emeagwali.net;
    client_max_body_size 10m;
    root /var/www/spip;
    index index.php;

    location / {
        # this is the usual way, but careful because all non-existing content will display home page with code 200
        try_files $uri $uri/ /spip.php?$args;
        # if you don't use rewriting (all internal links are already like spip.php?…), next line is enough
        #try_files $uri $uri/;
    }

    location ~^/(tmp|config)/{
        return 403;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php ;
        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~ /(tmp|config)/ {
        deny  all;
    }
}

/tmp と /local へのアクセスを拒否

SPIP はApacheと一緒に使われるように作成されました。つまり、htaccessを使わないwebサーバ上でSPIPをデプロイする場合、訪問者に tmp あるいは config (データベースのdumpが /tmp に格納されています。つまり訪問者はブルートフォースアタックによってadminパスワードを見つけることができます)のどちらへのアクセスも非許可にしなければなりません。

この種類のアタックを避けるもう一つの方法は:

  1. spip rootパスの外側にそれらのディレクトリを置く
  2. mes_options.php内の_DIR_TMP & _DIR_CONNECT 定数を再定義します。

fastcgi バッファ

fastcgi_buffers と fastcgi_buffers_size は "upstream sent too big header while reading response header from upstream" エラーを避けるためのものです。

inserted by FC2 system