Help us understand the problem. What is going on with this article?

[ Nginx × KUSANAGI ] www 付きドメイン から www なしドメインへのリダイレクト設定

More than 1 year has passed since last update.

環境

  • さくらの VPS
  • KUSANAGI ( CentOS 7 )
  • WordPress
  • KUSANAGI で SSL 化済み

設定

  • /etc/nginx/conf.d 内の example_ssl.conf の下記のように編集する
#=======================================
# example.com SSL
#---------------------------------------

server {
    listen 443 ssl http2;
    server_name www.example.com;
    rewrite ^ https://example.com$request_uri?;
}

server {
    listen       443 ssl http2;
    server_name  example.com;
    # 以下省略
}
  • 編集後、nginx -s reload or kusanagi restart で Nginx を再起動
ikyu
「こころに贅沢を」をコンセプトに一休.com、一休レストランなどのサービスを提供しています。
https://www.ikyu.com
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away