質問編集履歴
3
タイトル変更と求める解決策について
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
httpsへのアクセスをhttpにリダイレクトさせる方法
|
test
CHANGED
@@ -10,9 +10,15 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
-
|
13
|
+
---
|
14
14
|
|
15
|
+
|
16
|
+
|
17
|
+
追記です。
|
18
|
+
|
15
|
-
http://unitopi.com/sakura_rapid_ssl/
|
19
|
+
SSL化の失敗についてですが、[こちらの記事](http://unitopi.com/sakura_rapid_ssl/)の手順に従って証明書の入手と秘密鍵の作成を行い、nginxの設定をしました。
|
20
|
+
|
21
|
+
|
16
22
|
|
17
23
|
|
18
24
|
|
@@ -115,3 +121,37 @@
|
|
115
121
|
それから慌ててnginx.confを元に戻してservice nginx restartしたのですが、そのときにアクセスしたページは今でも勝手にhttpsにアクセスされてしまい正常に接続できない状態になっています。
|
116
122
|
|
117
123
|
https化している最中にアクセスしていないページには通常通りアクセスできるのですが…
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
---
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
更に追記です。
|
132
|
+
|
133
|
+
https://へのアクセスをhttp://にリダイレクトできれば解決すると考え、[こちらの記事](http://qiita.com/ywatai@github/items/a179186a458a42b3c7f0)を参考に現在のnginx.confに以下の記述を追記しました。
|
134
|
+
|
135
|
+
```
|
136
|
+
|
137
|
+
server {
|
138
|
+
|
139
|
+
listen 443;
|
140
|
+
|
141
|
+
server_name example.com;
|
142
|
+
|
143
|
+
return 302 http://$host$request_uri;
|
144
|
+
|
145
|
+
}
|
146
|
+
|
147
|
+
server {
|
148
|
+
|
149
|
+
listen 80;
|
150
|
+
|
151
|
+
(以下略)
|
152
|
+
|
153
|
+
```
|
154
|
+
|
155
|
+
これでhttps://example.comへのアクセスをhttp://example.comにリダイレクトできると思ったのですが、リダイレクトされません。
|
156
|
+
|
157
|
+
どうしたらブラウザにhttps://example.comにアクセスするのをやめさせられるでしょうか?
|
2
誤字修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -112,6 +112,6 @@
|
|
112
112
|
|
113
113
|
ところが設定後、URLはhttpsになるものの、Chromeなどからアクセスすると「この接続ではプライバシーが保護されません」「NET::ERR_CERT_AUTHORITY_INVALID」というエラーが出てアクセスできませんでした。
|
114
114
|
|
115
|
-
それから慌てて
|
115
|
+
それから慌ててnginx.confを元に戻してservice nginx restartしたのですが、そのときにアクセスしたページは今でも勝手にhttpsにアクセスされてしまい正常に接続できない状態になっています。
|
116
116
|
|
117
117
|
https化している最中にアクセスしていないページには通常通りアクセスできるのですが…
|
1
SSL化の失敗時の状況を追記しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -7,3 +7,111 @@
|
|
7
7
|
環境はさくらのVPSでnginxをフロントエンドに置いてバックエンドのApacheにアクセスを振り分けています
|
8
8
|
|
9
9
|
お知恵をお借りできれば幸いです
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
SSL化の失敗についてですが、こちらのサイトの手順に従って証明書の入手と秘密鍵の作成を行い、nginxの設定をしました。
|
14
|
+
|
15
|
+
http://unitopi.com/sakura_rapid_ssl/
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
nginxの設定はこうしました
|
20
|
+
|
21
|
+
```
|
22
|
+
|
23
|
+
http {
|
24
|
+
|
25
|
+
upstream appserver {
|
26
|
+
|
27
|
+
ip_hash;
|
28
|
+
|
29
|
+
server xxx.xxx.xxx.xxx;
|
30
|
+
|
31
|
+
server yyy.yyy.yyy.yyy:8080;
|
32
|
+
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
server {
|
38
|
+
|
39
|
+
#httpへのアクセスをhttpsにリダイレクトする
|
40
|
+
|
41
|
+
listen 80;
|
42
|
+
|
43
|
+
server_name example.com;
|
44
|
+
|
45
|
+
return 301 https://$host$request_uri;
|
46
|
+
|
47
|
+
}
|
48
|
+
|
49
|
+
server{
|
50
|
+
|
51
|
+
listen 443;
|
52
|
+
|
53
|
+
server_name example.com;
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
ssl on;
|
58
|
+
|
59
|
+
ssl_certificate /etc/nginx/ssl/example.com.2017.pem;
|
60
|
+
|
61
|
+
ssl_certificate_key /etc/nginx/ssl/example.com.2017.key;
|
62
|
+
|
63
|
+
ssl_session_timeout 5m;
|
64
|
+
|
65
|
+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
66
|
+
|
67
|
+
ssl_ciphers HIGH:!aNULL:!MD5;
|
68
|
+
|
69
|
+
ssl_prefer_server_ciphers on;
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
server_tokens off;
|
74
|
+
|
75
|
+
client_max_body_size 10m;
|
76
|
+
|
77
|
+
client_body_buffer_size 1m;
|
78
|
+
|
79
|
+
proxy_read_timeout 120;
|
80
|
+
|
81
|
+
limit_conn connections 10;
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
location / {
|
86
|
+
|
87
|
+
proxy_pass http://appserver;
|
88
|
+
|
89
|
+
proxy_redirect http:// https://;
|
90
|
+
|
91
|
+
proxy_set_header Host $host;
|
92
|
+
|
93
|
+
proxy_set_header X-Real-IP $remote_addr;
|
94
|
+
|
95
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
96
|
+
|
97
|
+
proxy_set_header X-Forwarded-Server $host;
|
98
|
+
|
99
|
+
proxy_set_header X-Forwarded-Host $host;
|
100
|
+
|
101
|
+
proxy_set_header X-Forwarded-Proto https;
|
102
|
+
|
103
|
+
proxy_max_temp_file_size 0;
|
104
|
+
|
105
|
+
}
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
```
|
112
|
+
|
113
|
+
ところが設定後、URLはhttpsになるものの、Chromeなどからアクセスすると「この接続ではプライバシーが保護されません」「NET::ERR_CERT_AUTHORITY_INVALID」というエラーが出てアクセスできませんでした。
|
114
|
+
|
115
|
+
それから慌てて設定を元に戻したのですが、そのときにアクセスしたページは今でも勝手にhttpsにアクセスされてしまい正常に接続できない状態になっています。
|
116
|
+
|
117
|
+
https化している最中にアクセスしていないページには通常通りアクセスできるのですが…
|