研究室のMacがwebサーバーになってて、今まではapacheを使ってたんだけどnginx使うようにしたらホームディレクトリが表示できなかったので、nginxの設定書いた。
既に各自のホームディレクトリにあるファイルにwiki等からリンクが貼られているので、切れると面倒

このへん参考にした HttpCoreModule

今までは /Users/sho/Sites/test.html が
http://masui.sfc.keio.ac.jp/~sho/test.html
で見えていたので、そのようにしたい。

locationを書いた

server {
listen 80;
server_name localhost;
server_name "masui.sfc.keio.ac.jp";
server_name "~^masuilab\.(org|net|com)$";
charset utf-8;
root /Volumes/share/Web;
autoindex on;
location / {
index index.html index.htm;
}
location ~ /~([a-zA-Z0-9_\-]+)(.*)$ { ## ホームディレクトリの設定
alias /Users/$1/Sites$2;
index index.html index.htm;
}
## 略
}

ついでに http://sho.masuilab.org/test.html でも見れるようにした
server {
listen 80;
charset utf-8;
server_name "~^(?<user>[a-zA-Z0-9_\-]+)\.masuilab\.(.+)$";
root /Users/$user/Sites;
autoindex on;
location / {
index index.html index.htm;
}
}