ググってみたら下記の記述発見。
nginx で http でのアクセスを https にリダイレクト http://qiita.com/kga/items/e30d668ec1ac5e30025bde-gucci.comでは Conoha の VPS で KUSANAGI (nginx) を使っています。 普通のnginxだと、/etc/nginx/nginx.conf かもしれません。 https://de-gucci.com 、http://www.de-gucci.com のアクセスを https://de-gucci.com へリダイレクトするために、/etc/nginx/conf.d/kusanagi_html_http.conf に次のように記述
server {
listen 80;
server_name de-gucci.com;
#略(Access.log、Error.log出力の記述)
return 301 https://$host$request_uri;
}
server {
listen 80;
server_name www.de-gucci.com;
#略(Access.log、Error.log出力の記述)
return 301 https://de-gucci.com$request_uri;
}
さらに https://www.de-gucci.com へのアクセスも https://de-gucci.com へリダイレクトするために
/etc/nginx/conf.d/kusanagi_html_ssl.conf に次の記述を追加
server {
listen 443 ssl http2;
server_name www.de-gucci.com;
#略(Access.log、Error.log出力の記述)
return 301 https://de-gucci.com$request_uri;
}
]]>