質問編集履歴

2

ファイル修正

2021/06/08 03:38

投稿

KOO_
KOO_

スコア58

test CHANGED
@@ -1 +1 @@
1
- nginxで意図するサイトと別のサイトが表示される問題について
1
+ nginxで意図するサイトと別のサイトが表示される問題について
test CHANGED
@@ -34,25 +34,69 @@
34
34
 
35
35
  ```
36
36
 
37
+ server {
37
38
 
39
+ # http -> https にリダイレクトする場合、次のように設定します。
38
40
 
39
- user nginx;
41
+ if ($host = hoge.com) {
40
42
 
41
- worker_processes 1;
43
+ return 301 https://$host$request_uri;
42
44
 
43
-
44
-
45
- error_log /var/log/nginx/error.log warn;
46
-
47
- pid /var/run/nginx.pid;
45
+ } # managed by Certbot
48
46
 
49
47
 
50
48
 
51
49
 
52
50
 
53
- events {
51
+ listen 80;
54
52
 
53
+ server_name hoge.com
54
+
55
+ rreturn 301 https://$server_name$request_uri;
56
+
57
+
58
+
59
+
60
+
61
+ }
62
+
63
+ server {
64
+
65
+ listen 443 ssl http2;
66
+
67
+ server_name hoge.com
68
+
69
+ ssl_certificate /etc/letsencrypt/live/hoge.com/fullchain.pem; # managed by Certbot
70
+
71
+ ssl_certificate_key /etc/letsencrypt/live/hoge.com/privkey.pem; # managed by Certbot
72
+
73
+
74
+
75
+ #charset koi8-r;
76
+
77
+ client_max_body_size 20M;
78
+
79
+ location / {
80
+
81
+ proxy_set_header Host $host;
82
+
83
+ proxy_set_header X-Real-IP $remote_addr;
84
+
85
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
86
+
87
+ proxy_set_header X-Forwarded-Proto $scheme;
88
+
89
+ proxy_pass http://unix:/tmp/lp_kaitai.sock;
90
+
55
- worker_connections 1024;
91
+ proxy_read_timeout 90;
92
+
93
+ }
94
+
95
+
96
+
97
+ access_log /var/log/nginx/lp_kaitai.access.log main;
98
+
99
+ error_log /var/log/nginx/lp_kaitai_error.log warn;
56
100
 
57
101
  }
58
102
 
@@ -60,44 +104,6 @@
60
104
 
61
105
 
62
106
 
63
- http {
64
-
65
- include /etc/nginx/mime.types;
66
-
67
- default_type application/octet-stream;
68
-
69
-
70
-
71
- log_format main '$remote_addr - $remote_user [$time_local] "$request" '
72
-
73
- '$status $body_bytes_sent "$http_referer" '
74
-
75
- '"$http_user_agent" "$http_x_forwarded_for"';
76
-
77
-
78
-
79
- access_log /var/log/nginx/access.log main;
80
-
81
-
82
-
83
- sendfile on;
84
-
85
- #tcp_nopush on;
86
-
87
-
88
-
89
- keepalive_timeout 65;
90
-
91
-
92
-
93
- #gzip on;
94
-
95
-
96
-
97
- include /etc/nginx/conf.d/*.conf;
98
-
99
- }
100
-
101
107
 
102
108
 
103
109
  ```

1

nginx.confファイル追加

2021/06/08 03:37

投稿

KOO_
KOO_

スコア58

test CHANGED
File without changes
test CHANGED
@@ -27,3 +27,77 @@
27
27
 
28
28
 
29
29
  どこまで情報を開示すれば良いかわからず情報不足かもしれませんが、ご教示よろしくお願い致します。
30
+
31
+
32
+
33
+ 【nginx.confファイル】
34
+
35
+ ```
36
+
37
+
38
+
39
+ user nginx;
40
+
41
+ worker_processes 1;
42
+
43
+
44
+
45
+ error_log /var/log/nginx/error.log warn;
46
+
47
+ pid /var/run/nginx.pid;
48
+
49
+
50
+
51
+
52
+
53
+ events {
54
+
55
+ worker_connections 1024;
56
+
57
+ }
58
+
59
+
60
+
61
+
62
+
63
+ http {
64
+
65
+ include /etc/nginx/mime.types;
66
+
67
+ default_type application/octet-stream;
68
+
69
+
70
+
71
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
72
+
73
+ '$status $body_bytes_sent "$http_referer" '
74
+
75
+ '"$http_user_agent" "$http_x_forwarded_for"';
76
+
77
+
78
+
79
+ access_log /var/log/nginx/access.log main;
80
+
81
+
82
+
83
+ sendfile on;
84
+
85
+ #tcp_nopush on;
86
+
87
+
88
+
89
+ keepalive_timeout 65;
90
+
91
+
92
+
93
+ #gzip on;
94
+
95
+
96
+
97
+ include /etc/nginx/conf.d/*.conf;
98
+
99
+ }
100
+
101
+
102
+
103
+ ```