teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

http.confファイルを追記しました。

2018/12/02 08:10

投稿

sawareco
sawareco

スコア18

title CHANGED
File without changes
body CHANGED
@@ -15,4 +15,146 @@
15
15
 
16
16
  **「http://www.サイトB」にアクセスしたときだけ、なぜかサイトAにリダイレクトしてしまいます。**
17
17
 
18
- KUSANAGI、NGINXの設定を何回も見ているのですが、どうしても解決できずにいます。詳しい方がいらっしゃいましたらご教授いただけないでしょうか?よろしくお願いいたします。
18
+ KUSANAGI、NGINXの設定を何回も見ているのですが、どうしても解決できずにいます。詳しい方がいらっしゃいましたらご教授いただけないでしょうか?よろしくお願いいたします。
19
+
20
+
21
+
22
+ ```ここに言語を入力
23
+ #=======================================
24
+ # サイトB
25
+ #---------------------------------------
26
+
27
+ server {
28
+ listen 80;
29
+ server_name サイトB www.サイトB;
30
+ access_log /home/kusanagi/サイトB/log/nginx/access.log main;
31
+ error_log /home/kusanagi/サイトB/log/nginx/error.log warn;
32
+
33
+ rewrite ^(.*)$ https://サイトB$request_uri permanent; # SSL ONLY
34
+ rewrite ^(.*)$ https://www.サイトB$request_uri permanent; # SSL ONLY
35
+ charset UTF-8;
36
+ client_max_body_size 16M;
37
+ root /home/kusanagi/サイトB/DocumentRoot;
38
+ index index.php index.html index.htm;
39
+
40
+ location = /50x.html {
41
+ return 403;
42
+ }
43
+
44
+
45
+ rewrite /wp-admin$ $scheme://$host$uri/ permanent;
46
+
47
+ location / {
48
+ try_files $uri $uri/ /index.php?$args;
49
+ #include naxsi.d/wordpress/*.conf;
50
+ }
51
+
52
+ location = /favicon.ico {
53
+ log_not_found off;
54
+ access_log off;
55
+ }
56
+
57
+ location ~* /.well-known {
58
+ allow all;
59
+ }
60
+
61
+ location ~* /. {
62
+ deny all;
63
+ }
64
+
65
+ #include templates.d/multisite.conf;
66
+
67
+ location ~* /(?:uploads|files)/.*.php$ {
68
+ deny all;
69
+ }
70
+
71
+ location ~* .(jpg|jpeg|gif|png|css|js|swf|ico|pdf|svg|eot|ttf|woff)$ {
72
+ expires 60d;
73
+ access_log off;
74
+ }
75
+
76
+ location ~* /wp-login.php|/wp-admin/((?!(admin-ajax.php|images/)).)*$ {
77
+
78
+ satisfy any;
79
+ allow 0.0.0.0/0;
80
+ allow 127.0.0.1;
81
+ deny all;
82
+ auth_basic "basic authentication";
83
+ auth_basic_user_file "/home/kusanagi/.htpasswd";
84
+
85
+ location ~ [^/].php(/|$) {
86
+
87
+ fastcgi_split_path_info ^(.+?.php)(/.*)$;
88
+ if (!-f $document_root$fastcgi_script_name) {
89
+ return 404;
90
+ }
91
+ fastcgi_pass 127.0.0.1:9000;
92
+ fastcgi_index index.php;
93
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
94
+ include fastcgi_params;
95
+ fastcgi_buffers 256 128k;
96
+ fastcgi_buffer_size 128k;
97
+ fastcgi_intercept_errors on;
98
+ fastcgi_read_timeout 120s;
99
+ #include naxsi.d/wordpress/*.conf;
100
+ }
101
+ include conf.d/security.conf;
102
+ #include naxsi.d/wordpress/*.conf;
103
+ }
104
+
105
+ location ~ [^/].php(/|$) {
106
+
107
+ fastcgi_split_path_info ^(.+?.php)(/.*)$;
108
+ if (!-f $document_root$fastcgi_script_name) {
109
+ return 404;
110
+ }
111
+ fastcgi_pass 127.0.0.1:9000;
112
+ fastcgi_index index.php;
113
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
114
+ include fastcgi_params;
115
+ fastcgi_buffers 256 128k;
116
+ fastcgi_buffer_size 128k;
117
+ fastcgi_intercept_errors on;
118
+ fastcgi_read_timeout 120s;
119
+
120
+ set $do_not_cache 1; ## page cache
121
+ set $device "pc";
122
+
123
+ if ($request_method = POST) {
124
+ set $do_not_cache 1;
125
+ }
126
+
127
+ if ($query_string != "") {
128
+ set $do_not_cache 1;
129
+ }
130
+
131
+ if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
132
+ set $do_not_cache 1;
133
+ }
134
+
135
+ 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;
136
+ }
137
+
138
+ if ($http_user_agent ~* " Android |(iPad|Android; Tablet; .+Firefox") {
139
+ set $device "tablet";
140
+ }
141
+
142
+ if ($http_user_agent ~* "Android .+ Mobile|(iPhone|(iPod|IEMobile|Android; Mobile; .+Firefox|Windows Phone") {
143
+ set $device "smart";
144
+ }
145
+
146
+ fastcgi_cache wpcache;
147
+ fastcgi_cache_key "$device:$request_method:$scheme://$host$request_uri";
148
+ fastcgi_cache_valid 200 10m;
149
+ fastcgi_no_cache $do_not_cache;
150
+ fastcgi_cache_bypass $do_not_cache;
151
+
152
+ add_header X-F-Cache $upstream_cache_status;
153
+ add_header X-Signature KUSANAGI;
154
+ include conf.d/security.conf;
155
+ #include naxsi.d/wordpress/*.conf;
156
+ }
157
+
158
+ }
159
+
160
+ ```