nginx

起動

$ sudo nginx

設定ファイルテスト

$ sudo nginx -t

リロード

$ sudo nginx -s reload

停止

$ sudo nginx -s stop

参考:

さくら VPS の Ubuntu 10.04 に nginx + PHP(FastCGI) な Web サーバーを構築する

コンテントネゴシエーションもどき

hoge.ja.html と hoge.en.htmlがあるとき、

Accept-Languageが日本語(ja)なら hoge.ja.html を返し、それ以外は hoge.en.html を返す。

location / {

index index.html;

rewrite ^(.*)/$ $1/index.html;

try_files $uri $uri/ @rewrite;

}

location @rewrite {

set $langsuffix 'en';

if ($http_accept_language ~* '^ja') {

set $langsuffix 'ja';

}

rewrite ^(.*)\.html$ $1.$langsuffix.html last;

}

参考:

nginxでコンテントネゴシエーションもどき - yellowback's blog