質問編集履歴

2

コメントいただいたものを反映しました。関係ない箇所かと思ったので省略していた箇所があったので、念のため追記しました。

2020/01/29 06:12

投稿

sasaki_nuno
sasaki_nuno

スコア13

test CHANGED
File without changes
test CHANGED
@@ -34,136 +34,226 @@
34
34
 
35
35
 
36
36
 
37
+ #server {
38
+
39
+ # listen 80;
40
+
41
+ # listen 443;
42
+
43
+ # server_name example.com;
44
+
45
+ # return 301 https://www.example.com$request_uri;
46
+
47
+ #}
48
+
49
+
50
+
37
51
  server {
38
52
 
53
+ listen 443 default_server;
54
+
55
+ ssl on;
56
+
57
+
58
+
59
+ root /var/www/html;
60
+
61
+ index index.php index.html index.htm;
62
+
63
+
64
+
65
+ ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
66
+
67
+ ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
68
+
69
+
70
+
71
+ try_files $uri $uri/ /html/example/index.php?$args;
72
+
73
+ server_name example.com;
74
+
75
+
76
+
77
+ location ^~ /sub/ {
78
+
79
+ proxy_pass http://xxx.xxx.xxx.xxx/sub;
80
+
81
+ proxy_redirect http:// https://;
82
+
83
+ proxy_set_header Host $host;
84
+
85
+ proxy_set_header X-Real-IP $remote_addr;
86
+
87
+ proxy_set_header X-Forwarded-Proto $scheme;
88
+
89
+ proxy_set_header X-Forwarded-Host $host;
90
+
91
+ proxy_set_header X-Forwarded-Server $host;
92
+
93
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
94
+
95
+ }
96
+
97
+
98
+
99
+ location / {
100
+
101
+ ssi on;
102
+
103
+ ssi_last_modified on;
104
+
105
+ try_files $uri $uri/ @wordpress;
106
+
107
+ }
108
+
109
+
110
+
111
+ location ~ .html$ {
112
+
113
+ root html;
114
+
115
+ fastcgi_pass 127.0.0.1:9000;
116
+
117
+ fastcgi_index index.html;
118
+
119
+ fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
120
+
121
+ include fastcgi_params;
122
+
123
+ }
124
+
125
+
126
+
127
+ location ~ .php$ {
128
+
129
+ try_files $uri @wordpress;
130
+
131
+ fastcgi_index index.php;
132
+
133
+ fastcgi_split_path_info ^(.+.php)(.*)$;
134
+
135
+ fastcgi_pass 127.0.0.1:9000;
136
+
137
+ fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
138
+
139
+ include fastcgi_params;
140
+
141
+ }
142
+
143
+
144
+
145
+ location @wordpress {
146
+
147
+ fastcgi_index index.php;
148
+
149
+ fastcgi_split_path_info ^(.+.php)(.*)$;
150
+
151
+ fastcgi_pass 127.0.0.1:9000;
152
+
153
+ fastcgi_param SCRIPT_FILENAME /var/www/html/example/index.php;
154
+
155
+ include fastcgi_params;
156
+
157
+ }
158
+
159
+ }
160
+
161
+
162
+
163
+ server {
164
+
165
+
166
+
39
167
  listen 80;
40
168
 
169
+ root /var/www/html;
170
+
171
+
172
+
41
- listen 443;
173
+ index index.php index.html index.htm;
174
+
175
+
176
+
177
+ try_files $uri $uri/ /html/example/index.php?$args;
178
+
179
+
42
180
 
43
181
  server_name example.com;
44
182
 
183
+
184
+
185
+ # reverse proxy
186
+
187
+ location /sub/ {
188
+
45
- return 301 https://www.example.com$request_uri;
189
+ proxy_pass http://xxx.xxx.xxx.xxx/sub/;
190
+
191
+ }
192
+
193
+
194
+
195
+ location / {
196
+
197
+ ssi on;
198
+
199
+ ssi_last_modified on;
200
+
201
+ try_files $uri $uri/ @wordpress;
202
+
203
+ }
204
+
205
+
206
+
207
+ location ~ /wp-login.php.* {
208
+
209
+ fastcgi_pass 127.0.0.1:9000;
210
+
211
+ fastcgi_index index.php;
212
+
213
+ fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
214
+
215
+ include fastcgi_params;
216
+
217
+ }
218
+
219
+
220
+
221
+ location ~ .php$ {
222
+
223
+ try_files $uri @wordpress;
224
+
225
+ fastcgi_index index.php;
226
+
227
+ fastcgi_split_path_info ^(.+.php)(.*)$;
228
+
229
+ fastcgi_pass 127.0.0.1:9000;
230
+
231
+ fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
232
+
233
+ include fastcgi_params;
234
+
235
+ }
236
+
237
+
238
+
239
+ location @wordpress {
240
+
241
+ fastcgi_index index.php;
242
+
243
+ fastcgi_split_path_info ^(.+.php)(.*)$;
244
+
245
+ fastcgi_pass 127.0.0.1:9000;
246
+
247
+ fastcgi_param SCRIPT_FILENAME /var/www/html/example/index.php;
248
+
249
+ include fastcgi_params;
250
+
251
+ }
46
252
 
47
253
  }
48
254
 
49
255
 
50
256
 
51
- server {
52
-
53
- listen 443 default_server;
54
-
55
- ssl on;
56
-
57
-
58
-
59
- root /var/www/html;
60
-
61
- index index.php index.html index.htm;
62
-
63
-
64
-
65
- location ^~ /sub/ {
66
-
67
- proxy_pass http://xxx.xxx.xxx.xxx/sub;
68
-
69
- proxy_redirect http:// https://;
70
-
71
- proxy_set_header Host $host;
72
-
73
- proxy_set_header X-Real-IP $remote_addr;
74
-
75
- proxy_set_header X-Forwarded-Proto $scheme;
76
-
77
- proxy_set_header X-Forwarded-Host $host;
78
-
79
- proxy_set_header X-Forwarded-Server $host;
80
-
81
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
82
-
83
- }
84
-
85
-
86
-
87
- location / {
88
-
89
- ssi on;
90
-
91
- ssi_last_modified on;
92
-
93
- try_files $uri $uri/ @wordpress;
94
-
95
- }
96
-
97
-
98
-
99
- location @wordpress {
100
-
101
- fastcgi_index index.php;
102
-
103
- fastcgi_split_path_info ^(.+.php)(.*)$;
104
-
105
- fastcgi_pass 127.0.0.1:9000;
106
-
107
- fastcgi_param SCRIPT_FILENAME /var/www/html/example/index.php;
108
-
109
- include fastcgi_params;
110
-
111
- }
112
-
113
- }
114
-
115
-
116
-
117
- server {
118
-
119
-
120
-
121
- listen 80;
122
-
123
- root /var/www/html;
124
-
125
-
126
-
127
- # revers proxy
128
-
129
- location /sub/ {
130
-
131
- proxy_pass http://xxx.xxx.xxx.xxx/sub/;
132
-
133
- }
134
-
135
-
136
-
137
- location / {
138
-
139
- ssi on;
140
-
141
- ssi_last_modified on;
142
-
143
- try_files $uri $uri/ @wordpress;
144
-
145
- }
146
-
147
-
148
-
149
- location @wordpress {
150
-
151
- fastcgi_index index.php;
152
-
153
- fastcgi_split_path_info ^(.+.php)(.*)$;
154
-
155
- fastcgi_pass 127.0.0.1:9000;
156
-
157
- fastcgi_param SCRIPT_FILENAME /var/www/html/example/index.php;
158
-
159
- include fastcgi_params;
160
-
161
- }
162
-
163
- }
164
-
165
-
166
-
167
257
  ```
168
258
 
169
259
 

1

confの設定を変更しました

2020/01/29 06:12

投稿

sasaki_nuno
sasaki_nuno

スコア13

test CHANGED
File without changes
test CHANGED
@@ -23,14 +23,6 @@
23
23
 
24
24
 
25
25
  上記の通り現在WordPressはSSL化しておりますが、MTはSSLしていないため、MTをSSL化したいと考えているのですが、リバースプロキシの設定がうまくいかずMTをうまくSSL化できていません。
26
-
27
-
28
-
29
-
30
-
31
- 当方インフラはほぼ素人なので基本的なことがあまりわかっておりません。
32
-
33
- ご了承ください。
34
26
 
35
27
 
36
28
 
@@ -70,17 +62,23 @@
70
62
 
71
63
 
72
64
 
73
- location /sub/ {
65
+ location ^~ /sub/ {
74
66
 
75
- root html;
67
+ proxy_pass http://xxx.xxx.xxx.xxx/sub;
76
68
 
77
- fastcgi_pass 127.0.0.1:9000;
69
+ proxy_redirect http:// https://;
78
70
 
79
- fastcgi_index index.html;
71
+ proxy_set_header Host $host;
80
72
 
81
- fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
73
+ proxy_set_header X-Real-IP $remote_addr;
82
74
 
75
+ proxy_set_header X-Forwarded-Proto $scheme;
76
+
83
- include fastcgi_params;
77
+ proxy_set_header X-Forwarded-Host $host;
78
+
79
+ proxy_set_header X-Forwarded-Server $host;
80
+
81
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
84
82
 
85
83
  }
86
84
 
@@ -132,12 +130,6 @@
132
130
 
133
131
  proxy_pass http://xxx.xxx.xxx.xxx/sub/;
134
132
 
135
- proxy_set_header Host $http_host;
136
-
137
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
138
-
139
- proxy_redirect http:// https://;
140
-
141
133
  }
142
134
 
143
135
 
@@ -176,8 +168,20 @@
176
168
 
177
169
 
178
170
 
179
- ※ いろいろと端折ってます。
171
+ 現状、上記ののような設定を行っておりして、https://example.com/sub にアクセスると、http://example.com/sub が表示されます
180
172
 
181
173
 
182
174
 
175
+ ```
176
+
177
+ #proxy_pass http://xxx.xxx.xxx.xxx/sub;
178
+
179
+ proxy_pass http://xxx.xxx.xxx.xxx/sub2;
180
+
181
+ ```
182
+
183
+
184
+
185
+ 不可解なのが、上記のように変更しても接続先が変更されず、locationの優先順位などが間違っているのかと思いましたが、さっぱりわかりません。
186
+
183
- 上記わかる方がいらっしゃればアドバイスいただけると助かります。
187
+ 当方インフラに詳しくないため、どなたかわかるようであれば詳しく教えていただけると助かります。