WordPress 公式プラグイン の Google の検索結果にレーティングが表示されてる。

WordPress.org が Schema.org の microdata に対応したからみたい。
レーティングの辺りを見ると、こんなコードが挿入されてる。

<meta itemprop="ratingValue" content="3.4">
<meta itemprop="ratingCount" content="32">

WordPress.com が Gist の埋め込みに対応したみたい

WordPress.com サイトに埋め込み可能になった3つのサービスについてご案内します。
(訳注: Spotify と Rdio は現在日本からのユーザー登録に対応していません。海外で作成した有効なアカウントをお持ちの場合のみ、ログインして再生できます)

via. GitHub Gist、Spotify、Rdio の埋め込みに対応 — ブログ —
WordPress.com

WordPress.com が Gist の埋め込みに対応したみたいなので、テスト。

Nginx のバックエンドとの通信には Unix ドメインソケットも使用できる

こんな感じ。

upstream backend {
    server unix:/var/run/nginx-backend.sock;
}

server {
    listen unix:/var/run/nginx-backend.sock;
    server_name  _;
     :
}

server {
    listen 80;
    server_name  _;
     :
    location / {
        proxy_redirect off;
        proxy_cache one;
        proxy_cache_key "$scheme://$host$request_uri$is_args$args";
        proxy_cache_valid  200 60m;
        proxy_cache_valid  404 5m;
        proxy_pass http://backend;
    }
}

s3fs のインストール

fuse をインストール

$ wget http://sourceforge.net/projects/fuse/files/fuse-2.X/2.8.7/fuse-2.8.7.tar.gz/download
$ tar xvfz fuse-2.8.7.tar.gz
$ cd fuse-2.8.7
$ ./configure prefix=/usr
$ make
$ sudo make install
$ sudo ldconfig
$ sudo modprobe fuse

s3fs をインストール

$ export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib64/pkgconfig/
$ wget http://s3fs.googlecode.com/files/s3fs-1.61.tar.gz
$ tar xvfz s3fs-1.61.tar.gz
$ cd s3fs-1.61
$ ./configure prefix=/usr
$ make
$ sudo make install

s3fs の設定

$ echo "{accesskey}:{secretkey}" > /etc/passwd-s3fs
$ sudo chmod 600 /etc/passwd-s3fs
$ sudo mkdir /mnt/s3

使い方

$ sudo s3fs {bucket} /mnt/s3 -o default_acl=public-read

パフォーマンスチューニングした WordPress のベンチ

色々、やった結果 Amazon EC2 Micro インスタンス上に構築している WordPress 上で、ネットワーク越しでも ab -n 1000 -c 100 の結果が、これくらいになるようにはなった。
リソース少ないマシンをチューニングするのは楽しいすなぁ。

$ ab -n 1000 -c 100 -H 'Accept-Encoding: gzip' http://dogmap.jp/

Server Software:        nginx
Server Hostname:        dogmap.jp
Server Port:            80

Document Path:          /
Document Length:        14265 bytes

Concurrency Level:      100
Time taken for tests:   3.40771 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      14473818 bytes
HTML transferred:       14295933 bytes
Requests per second:    328.86 [#/sec] (mean)
Time per request:       304.077 [ms] (mean)
Time per request:       3.041 [ms] (mean, across all concurrent requests)
Transfer rate:          4648.16 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        8   11   5.5     10      43
Processing:    27  275  68.2    267     563
Waiting:       19  263  67.9    254     545
Total:         38  287  69.2    278     594

Percentage of the requests served within a certain time (ms)
  50%    278
  66%    290
  75%    317
  80%    338
  90%    371
  95%    394
  98%    427
  99%    520
 100%    594 (longest request)

秒間 328 リクエスト

ちなみに PHP Ninja 上の WordPress だと、このくらい。

$ ab -n 1000 -c 100 -H 'Accept-Encoding: gzip' http://ninja.dogmap.jp/
Server Software:        nginx
Server Hostname:        ninja.dogmap.jp
Server Port:            80

Document Path:          /
Document Length:        8783 bytes

Concurrency Level:      100
Time taken for tests:   1.548749 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      9063550 bytes
HTML transferred:       8812060 bytes
Requests per second:    645.68 [#/sec] (mean)
Time per request:       154.875 [ms] (mean)
Time per request:       1.549 [ms] (mean, across all concurrent requests)
Transfer rate:          5714.94 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       12   23  11.5     20      63
Processing:    32  123  45.0    125     206
Waiting:       14   87  45.4     80     172
Total:         46  146  40.3    149     218

Percentage of the requests served within a certain time (ms)
  50%    149
  66%    173
  75%    185
  80%    191
  90%    194
  95%    198
  98%    207
  99%    214
 100%    218 (longest request)

秒間 645 リクエスト、にばーいにばーい。

「download.fedora.redhat.com」が繋がらない

In any case, it’s gone now. Please take a few minutes to go and look and see if you have any docs or wiki pages or notes or anything else that refers to this old entry, and update it. Please point them to ‘dl.fedoraproject.org’ (if you want to point directly to our master mirrors) or ‘download.fedoraproject.org’ (If you want it to point to a mirrormanager mirror that contains the content you seek).

via. Please update your links: download.fedora.redhat.com -> dl.fedoraproject.org « Kevin’s musings

epel リポジトリの dl に失敗するようになったんですが、どうやら download.fedora.redhat.com が廃止されて 「dl.fedoraproject.org」 になったようです。

WordPressでプラグインなしで画像にパスワードをかける

試してないのですが、以下のように.htaccessで制御する記事を海外のブログで見つけたので、メモがわりに書いておきます。

この方法を使用するとプラグインを使わなくてもアップロードファイルにパスワード保護をかけられるので、SNS系のシステムなどを構築するのに便利かもしれません。

via. WordPressでプラグインなしで画像にパスワードをかける | firegoby

Nginx でやるなら、こんな感じ。

location ~ /wp-content/uploads/.* {
    if ($http_cookie !~ "wordpress_logged_in") {
        rewrite .*$ /wp-login.php?redirect_to=$uri permanent;
    }
}

厳密にはログインしてるかどうかは見てないので注意が必要ですよ。

Nginx の SSI (virtual)では相対パス指定ができない

こんなエラーが出る。

[an error occurred while processing the directive]

絶対パスで指定すれば大丈夫。

<!--#include virtual="/hoge/fuga.html"-->

Nginx で CodeIgniter を動かす

server {
	listen 80;
	server_name _;
	root /path/to/codeigniter;
	index  index.php index.html index.htm;
	charset utf-8;

	location / {
		if (-f $request_filename) {
			expires 30d;
			break;
		}
		if (!-e $request_filename) {
			rewrite ^(.*)$ /index.php?q=$1 last;
		}
	}

	location ~ application/.* { deny all; }
	location ~ system/.* { deny all; }
	location ~ /\.ht { deny all; }

	location ~ \.php$ {
		fastcgi_pass   127.0.0.1:9000;
		fastcgi_index  index.php;
		fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_intercept_errors on;
		include        fastcgi_params;
	}
}

SOPA/PIPA への抗議

stop SOPA/PIPA

WordPress.org

stop SOPA/PIPA

WordPress.com

現在、WordPress.com、WordPress.org 共に SOPA/PIPA 法案への抗議として、トップページが変更されているようですね。

フォロー

Get every new post delivered to your Inbox.

現在1,816人フォロワーがいます。