「nginx」リダイレクトrewrite設定のメモ

設定内容
server {
listen 80;
server_name sample.com www.sample.com;
root /home/web;
if($host !~ “www\.sample\.com$") {
rewrite ^(.*) http://www.sample.com$1 permanent;
}
}
nginx再起動
/etc/init.d/nginx restart

Nginx

Posted by arkgame