質問編集履歴
2
質問大幅に変更修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
|
1
|
+
Ghost やphpmyadminをhttpsで開こうとするとNot found や 503 bad gatewayになる[centos7 + Nginx]
|
body
CHANGED
@@ -1,57 +1,101 @@
|
|
1
1
|
centos7 + Nginx の初心者です。皆様よろしくお願いいたします。
|
2
|
+
CerbotのSSLを使用しています。2つのドメインでindex.htmlなど静的ページ であればhttpsでの表示などできるようになりました。
|
3
|
+
GHOST CMSやphpmyadmin をインストールしてhttpでの表示はできますが、httpsで表示しようとするとNot found や bat gateway のエラーになってしまいます。
|
2
4
|
|
3
|
-
fastcgi_pass の書き方について教えてください。
|
4
|
-
|
5
|
+
mywebsite1.com とmywebsite2.com の両方でSSLで の表示はできています。
|
5
|
-
GHOST CMSや
|
6
|
+
GHOST CMSやphpmyadmin は mywebsite1.comのドメインで行おうとしています。
|
7
|
+
nginxの設定ファイルの書き方の問題だと思うのですが、何度書き方を変更しても上記の現象が改善されません。
|
6
|
-
|
8
|
+
正しい記述の方法を教えていただけますでしょうか?よろしくお願いいたします。
|
7
9
|
|
8
|
-
|
10
|
+
できるかぎり設定ファイルを分けて、綺麗に書くようにしましたがこの程度のレベルです。よろしくお願いいたします。
|
9
11
|
|
12
|
+
```ここに言語を入力
|
13
|
+
nginx -T
|
14
|
+
nginx: [warn] conflicting server name "mywebsite1.com" on 0.0.0.0:443, ignored
|
10
|
-
|
15
|
+
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
|
16
|
+
nginx: configuration file /etc/nginx/nginx.conf test is successful
|
11
17
|
|
12
|
-
私はバリュードメインで2つドメインを取得し、NTTのINDIGOを使っています。
|
13
|
-
固定IP(独自ドメイン)でGHOST CMSや phpmyadminなどを表示するときに
|
14
|
-
fastcgi_pass は 127.0.0.1:9000;のような値でいいのでしょうか?
|
15
18
|
|
16
|
-
|
19
|
+
# configuration file /etc/nginx/nginx.conf:
|
17
|
-
|
20
|
+
user nginx;
|
18
|
-
調べて値を変更しているのですが、どうしてもエラーが変わらずページも表示されません。
|
19
|
-
|
21
|
+
worker_processes 1;
|
20
22
|
|
23
|
+
error_log /var/log/nginx/error.log warn;
|
21
|
-
|
24
|
+
pid /var/run/nginx.pid;
|
22
25
|
|
23
|
-
|
24
|
-
■ vi /etc/nginx/conf.d/default.conf
|
25
|
-
|
26
|
-
|
26
|
+
events {
|
27
|
-
listen 80;
|
28
|
-
|
27
|
+
worker_connections 1024;
|
28
|
+
}
|
29
29
|
|
30
|
-
|
30
|
+
http {
|
31
|
-
|
31
|
+
include /etc/nginx/mime.types;
|
32
|
+
default_type application/octet-stream;
|
32
33
|
|
34
|
+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
35
|
+
'$status $body_bytes_sent "$http_referer" '
|
36
|
+
'"$http_user_agent" "$http_x_forwarded_for"';
|
37
|
+
|
38
|
+
access_log /var/log/nginx/access.log main;
|
39
|
+
|
40
|
+
sendfile on;
|
41
|
+
#tcp_nopush on;
|
42
|
+
|
43
|
+
keepalive_timeout 65;
|
44
|
+
|
45
|
+
#gzip on;
|
46
|
+
|
47
|
+
include /etc/nginx/conf.d/*.conf;
|
48
|
+
|
49
|
+
server {
|
50
|
+
|
51
|
+
|
52
|
+
|
33
|
-
|
53
|
+
location ~ .php$ {
|
54
|
+
fastcgi_pass 127.0.0.1:9000;
|
55
|
+
fastcgi_index index.php;
|
56
|
+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
57
|
+
include fastcgi_params;
|
58
|
+
}
|
59
|
+
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
# configuration file /etc/nginx/conf.d/default.conf:
|
66
|
+
server {
|
67
|
+
listen 443 ssl;
|
68
|
+
server_name mywebsite2.com;
|
69
|
+
charset UTF-8;
|
70
|
+
access_log /var/log/nginx/mywebsite2-access.log main;
|
71
|
+
ssl_certificate /etc/letsencrypt/live/mywebsite2.com/fullchain.pem;
|
72
|
+
ssl_certificate_key /etc/letsencrypt/live/mywebsite2.com/privkey.pem;
|
34
|
-
|
73
|
+
root /var/www/html/mywebsite2;
|
35
|
-
index index.html index.htm;
|
36
74
|
}
|
37
75
|
|
76
|
+
server {
|
77
|
+
listen 443 ssl;
|
38
|
-
|
78
|
+
server_name mywebsite1.com;
|
79
|
+
charset UTF-8;
|
80
|
+
ssl_certificate /etc/letsencrypt/live/mywebsite1.com/fullchain.pem;
|
81
|
+
ssl_certificate_key /etc/letsencrypt/live/mywebsite1.com/privkey.pem;
|
39
|
-
|
82
|
+
root /var/www/html/mywebsite1;
|
40
|
-
try_files $uri/ index.html index.php;
|
41
83
|
|
84
|
+
location /phpMyAdmin {
|
85
|
+
root /usr/share;
|
86
|
+
index index.php index.html index.htm;
|
87
|
+
try_files $uri $uri/ /index.php?$query_string;
|
42
88
|
location ~ ^/phpMyAdmin/(.+.php)$ {
|
43
|
-
|
89
|
+
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
|
44
|
-
|
90
|
+
fastcgi_index index.php;
|
45
|
-
fastcgi_param SCRIPT_FILENAME
|
91
|
+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
46
92
|
include fastcgi_params;
|
47
93
|
fastcgi_intercept_errors on;
|
48
|
-
|
49
94
|
}
|
50
95
|
}
|
51
96
|
|
52
97
|
|
53
98
|
|
54
|
-
|
55
99
|
#error_page 404 /404.html;
|
56
100
|
|
57
101
|
# redirect server error pages to the static page /50x.html
|
@@ -63,9 +107,6 @@
|
|
63
107
|
|
64
108
|
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
65
109
|
#
|
66
|
-
|
67
|
-
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
68
|
-
#
|
69
110
|
#location ~ .php$ {
|
70
111
|
# proxy_pass http://127.0.0.1;
|
71
112
|
#}
|
@@ -84,7 +125,63 @@
|
|
84
125
|
# concurs with nginx's one
|
85
126
|
#
|
86
127
|
#location ~ /.ht {
|
128
|
+
# deny all;
|
87
|
-
#
|
129
|
+
#}
|
130
|
+
}
|
88
131
|
|
89
132
|
|
133
|
+
# configuration file /etc/nginx/fastcgi_params:
|
134
|
+
|
135
|
+
fastcgi_param QUERY_STRING $query_string;
|
136
|
+
fastcgi_param REQUEST_METHOD $request_method;
|
137
|
+
fastcgi_param CONTENT_TYPE $content_type;
|
138
|
+
fastcgi_param CONTENT_LENGTH $content_length;
|
139
|
+
|
140
|
+
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
141
|
+
fastcgi_param REQUEST_URI $request_uri;
|
142
|
+
fastcgi_param DOCUMENT_URI $document_uri;
|
143
|
+
fastcgi_param DOCUMENT_ROOT $document_root;
|
144
|
+
fastcgi_param SERVER_PROTOCOL $server_protocol;
|
145
|
+
fastcgi_param REQUEST_SCHEME $scheme;
|
146
|
+
fastcgi_param HTTPS $https if_not_empty;
|
147
|
+
|
148
|
+
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
|
149
|
+
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
|
150
|
+
|
151
|
+
fastcgi_param REMOTE_ADDR $remote_addr;
|
152
|
+
fastcgi_param REMOTE_PORT $remote_port;
|
153
|
+
fastcgi_param SERVER_ADDR $server_addr;
|
154
|
+
fastcgi_param SERVER_PORT $server_port;
|
155
|
+
fastcgi_param SERVER_NAME $server_name;
|
156
|
+
|
157
|
+
# PHP only, required if PHP was built with --enable-force-cgi-redirect
|
158
|
+
fastcgi_param REDIRECT_STATUS 200;
|
159
|
+
|
160
|
+
# configuration file /etc/nginx/conf.d/ghost.conf:
|
161
|
+
upstream ghost {
|
162
|
+
server 127.0.0.1:2368;
|
163
|
+
}
|
164
|
+
server {
|
165
|
+
listen 443 ssl http2;
|
166
|
+
listen 80;
|
167
|
+
server_name mywebsite1.com;
|
168
|
+
|
169
|
+
ssl_certificate /etc/letsencrypt/live/mywebsite1.com/fullchain.pem;
|
170
|
+
ssl_certificate_key /etc/letsencrypt/live/mywebsite1.com/privkey.pem;
|
171
|
+
access_log /var/log/nginx/ghost.access.log;
|
172
|
+
error_log /var/log/nginx/ghost.error.log;
|
173
|
+
proxy_buffers 16 64k;
|
174
|
+
proxy_buffer_size 128k;
|
175
|
+
|
176
|
+
location / {
|
177
|
+
proxy_set_header X-Forwarded-Proto https;
|
178
|
+
|
179
|
+
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
|
180
|
+
proxy_redirect off;
|
181
|
+
proxy_set_header Host $host;
|
182
|
+
proxy_pass http://ghost;
|
183
|
+
proxy_set_header X-Real-IP $remote_addr;
|
184
|
+
proxy_set_header X-Forwarded-For $proxy_add_X_forwarded_for;
|
185
|
+
}
|
186
|
+
}
|
90
187
|
```
|
1
変更
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
failed (111: Connection refused) while connecting to upstream[centos7 + Nginx]
|
1
|
+
failed (111: Connection refused) while connecting to upstreamのエラーについて[centos7 + Nginx]
|
body
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
centos7 + Nginx の初心者です。よろしくお願いいたします。
|
1
|
+
centos7 + Nginx の初心者です。皆様よろしくお願いいたします。
|
2
2
|
|
3
3
|
fastcgi_pass の書き方について教えてください。
|
4
4
|
CerbotのSSLでindex.htmlの表示やバーチャルドメインの設定などはできるようになりました。
|
@@ -18,6 +18,8 @@
|
|
18
18
|
調べて値を変更しているのですが、どうしてもエラーが変わらずページも表示されません。
|
19
19
|
正しい書き方を教えていただけますでしょうか?よろしくお願いいたします。
|
20
20
|
|
21
|
+
```ここに言語を入力
|
22
|
+
|
21
23
|
|
22
24
|
■ vi /etc/nginx/conf.d/default.conf
|
23
25
|
|
@@ -82,4 +84,7 @@
|
|
82
84
|
# concurs with nginx's one
|
83
85
|
#
|
84
86
|
#location ~ /.ht {
|
85
|
-
#
|
87
|
+
#
|
88
|
+
|
89
|
+
|
90
|
+
```
|