ConohaVPSでkusanagiを使ってサイトを構築しています。
現在、2つのプロファイルを作成し、2つのドメインを割り当てています。(VPSは1アカウントです。)
そして、両サイトともに「SSL+www無し」にしようとしているのですが、リダイレクトが上手くいきません。
片方(サイトAとします)は問題なく「SSL+www無し」へリダイレクトするのですが、もう一方(サイトBとします)のリダイレクトが上手くいきません。下記のような状態です。
http://サイトA → https://サイトA (OKです)
http://www.サイトA → https://サイトA (OKです)
https://www.サイトA → https://サイトA (OKです)
http://サイトB → https://サイトB (OKです)
http://www.サイトB → https://サイトA (NGです)
https://www.サイトB → https://サイトB (OKです)
「http://www.サイトB」にアクセスしたときだけ、なぜかサイトAにリダイレクトしてしまいます。
KUSANAGI、NGINXの設定を何回も見ているのですが、どうしても解決できずにいます。詳しい方がいらっしゃいましたらご教授いただけないでしょうか?よろしくお願いいたします。
#======================================= # サイトB #--------------------------------------- server { listen 80; server_name サイトB www.サイトB; access_log /home/kusanagi/サイトB/log/nginx/access.log main; error_log /home/kusanagi/サイトB/log/nginx/error.log warn; rewrite ^(.*)$ https://サイトB$request_uri permanent; # SSL ONLY rewrite ^(.*)$ https://www.サイトB$request_uri permanent; # SSL ONLY charset UTF-8; client_max_body_size 16M; root /home/kusanagi/サイトB/DocumentRoot; index index.php index.html index.htm; location = /50x.html { return 403; } rewrite /wp-admin$ $scheme://$host$uri/ permanent; location / { try_files $uri $uri/ /index.php?$args; #include naxsi.d/wordpress/*.conf; } location = /favicon.ico { log_not_found off; access_log off; } location ~* /.well-known { allow all; } location ~* /. { deny all; } #include templates.d/multisite.conf; location ~* /(?:uploads|files)/.*.php$ { deny all; } location ~* .(jpg|jpeg|gif|png|css|js|swf|ico|pdf|svg|eot|ttf|woff)$ { expires 60d; access_log off; } location ~* /wp-login.php|/wp-admin/((?!(admin-ajax.php|images/)).)*$ { satisfy any; allow 0.0.0.0/0; allow 127.0.0.1; deny all; auth_basic "basic authentication"; auth_basic_user_file "/home/kusanagi/.htpasswd"; location ~ [^/].php(/|$) { fastcgi_split_path_info ^(.+?.php)(/.*)$; if (!-f $document_root$fastcgi_script_name) { return 404; } fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_buffers 256 128k; fastcgi_buffer_size 128k; fastcgi_intercept_errors on; fastcgi_read_timeout 120s; #include naxsi.d/wordpress/*.conf; } include conf.d/security.conf; #include naxsi.d/wordpress/*.conf; } location ~ [^/].php(/|$) { fastcgi_split_path_info ^(.+?.php)(/.*)$; if (!-f $document_root$fastcgi_script_name) { return 404; } fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_buffers 256 128k; fastcgi_buffer_size 128k; fastcgi_intercept_errors on; fastcgi_read_timeout 120s; set $do_not_cache 1; ## page cache set $device "pc"; if ($request_method = POST) { set $do_not_cache 1; } if ($query_string != "") { set $do_not_cache 1; } if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") { set $do_not_cache 1; } if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-c$ set $do_not_cache 1; } if ($http_user_agent ~* " Android |(iPad|Android; Tablet; .+Firefox") { set $device "tablet"; } if ($http_user_agent ~* "Android .+ Mobile|(iPhone|(iPod|IEMobile|Android; Mobile; .+Firefox|Windows Phone") { set $device "smart"; } fastcgi_cache wpcache; fastcgi_cache_key "$device:$request_method:$scheme://$host$request_uri"; fastcgi_cache_valid 200 10m; fastcgi_no_cache $do_not_cache; fastcgi_cache_bypass $do_not_cache; add_header X-F-Cache $upstream_cache_status; add_header X-Signature KUSANAGI; include conf.d/security.conf; #include naxsi.d/wordpress/*.conf; } }
あなたの回答
tips
プレビュー