質問編集履歴

4

関係ないので消しました

2021/01/04 02:48

投稿

fumiya.o
fumiya.o

スコア0

test CHANGED
File without changes
test CHANGED
@@ -226,42 +226,6 @@
226
226
 
227
227
 
228
228
 
229
-
230
-
231
- ### worker processの実行ユーザー
232
-
233
- 正常に動作しているcentOSとの比較のため`ps aux | grep nginx`をしたところ、worker processを実行しているユーザーが違いました。
234
-
235
- ```ubuntu
236
-
237
- USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
238
-
239
- root 161105 0.0 0.1 57300 1472 ? Ss Oct22 0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
240
-
241
- www-data 161106 0.0 0.4 57892 4496 ? S Oct22 0:00 nginx: worker process
242
-
243
- ```
244
-
245
-
246
-
247
- ```centOS
248
-
249
- USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
250
-
251
- root 21747 0.0 0.2 125776 2228 ? Ss 06:38 0:00 nginx: master process /usr/sbin/nginx
252
-
253
- nginx 21748 0.0 0.5 126208 5112 ? S 06:38 0:00 nginx: worker process
254
-
255
- ```
256
-
257
- それぞれのホームディレクトリが以下のように違いましたのでここに原因があるのかなと考えています。
258
-
259
- `www-data` => `/var/www`
260
-
261
- `nginx` => `/var/lib/nginx`
262
-
263
-
264
-
265
229
  ### 補足情報(FW/ツールのバージョンなど)
266
230
 
267
231
  nginx/1.18.0 (Ubuntu)

3

worker processの実行ユーザーについて記載

2021/01/04 02:47

投稿

fumiya.o
fumiya.o

スコア0

test CHANGED
File without changes
test CHANGED
@@ -228,6 +228,40 @@
228
228
 
229
229
 
230
230
 
231
+ ### worker processの実行ユーザー
232
+
233
+ 正常に動作しているcentOSとの比較のため`ps aux | grep nginx`をしたところ、worker processを実行しているユーザーが違いました。
234
+
235
+ ```ubuntu
236
+
237
+ USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
238
+
239
+ root 161105 0.0 0.1 57300 1472 ? Ss Oct22 0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
240
+
241
+ www-data 161106 0.0 0.4 57892 4496 ? S Oct22 0:00 nginx: worker process
242
+
243
+ ```
244
+
245
+
246
+
247
+ ```centOS
248
+
249
+ USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
250
+
251
+ root 21747 0.0 0.2 125776 2228 ? Ss 06:38 0:00 nginx: master process /usr/sbin/nginx
252
+
253
+ nginx 21748 0.0 0.5 126208 5112 ? S 06:38 0:00 nginx: worker process
254
+
255
+ ```
256
+
257
+ それぞれのホームディレクトリが以下のように違いましたのでここに原因があるのかなと考えています。
258
+
259
+ `www-data` => `/var/www`
260
+
261
+ `nginx` => `/var/lib/nginx`
262
+
263
+
264
+
231
265
  ### 補足情報(FW/ツールのバージョンなど)
232
266
 
233
267
  nginx/1.18.0 (Ubuntu)

2

試した事、バージョンの追記

2020/10/23 07:04

投稿

fumiya.o
fumiya.o

スコア0

test CHANGED
File without changes
test CHANGED
@@ -212,7 +212,17 @@
212
212
 
213
213
  ### 試したこと
214
214
 
215
- puma + sinatraをポート4567番で起動しサーバー内から`curl localhost:4567`とした時アプリのトップページが表示される事を確認しました。しかしブラウザから見た場合や`curl localhost:80`とした時に"welcome to enginx"が表示されます。nginxは正常に起動しておりエラーログも吐いていません。nginxの再起動も試していますがダメでした。
215
+ - puma + sinatraをポート4567番で起動しサーバー内から`curl localhost:4567`とした時アプリのトップページが表示される事を確認
216
+
217
+ - しかしブラウザから見た場合や`curl localhost:80`とした時に"welcome to enginx"が表示される
218
+
219
+ - nginxは正常に起動しておりエラーログも吐いていない
220
+
221
+ - nginxの再起動も試したがダメ
222
+
223
+ - nginxの再インストールやEC2でインスタンスを作り直し再度0から構築してもダメ
224
+
225
+ - AmazonLinux(centOS)では正常に動作する
216
226
 
217
227
 
218
228
 
@@ -220,4 +230,6 @@
220
230
 
221
231
  ### 補足情報(FW/ツールのバージョンなど)
222
232
 
233
+ nginx/1.18.0 (Ubuntu)
234
+
223
- AmazonLinux(centOS)で同様の組み合わせ、conf設定で試しましたがその場合は上手くいきました。
235
+ Ubuntu 20.04.1 LTS (Focal Fossa)

1

/etc/nginx/nginx.confの内容を追加しました

2020/10/23 01:33

投稿

fumiya.o
fumiya.o

スコア0

test CHANGED
File without changes
test CHANGED
@@ -12,6 +12,8 @@
12
12
 
13
13
  `/etc/nginx/conf.d/sinatra_test.conf`に以下のように記載しました。
14
14
 
15
+ `/etc/nginx/conf.d/`にあるのはこのファイルだけです。
16
+
15
17
  また、その他の設定については追加・変更しておらず初期状態と同じです。
16
18
 
17
19
  ```nginx
@@ -26,8 +28,186 @@
26
28
 
27
29
  }
28
30
 
31
+ ```
32
+
33
+
34
+
35
+ ↓デフォルトのままですが`/etc/nginx/nginx.conf`です
36
+
29
37
  ```
30
38
 
39
+ user www-data;
40
+
41
+ worker_processes auto;
42
+
43
+ pid /run/nginx.pid;
44
+
45
+ include /etc/nginx/modules-enabled/*.conf;
46
+
47
+
48
+
49
+ events {
50
+
51
+ worker_connections 768;
52
+
53
+ # multi_accept on;
54
+
55
+ }
56
+
57
+
58
+
59
+ http {
60
+
61
+
62
+
63
+ ##
64
+
65
+ # Basic Settings
66
+
67
+ ##
68
+
69
+
70
+
71
+ sendfile on;
72
+
73
+ tcp_nopush on;
74
+
75
+ tcp_nodelay on;
76
+
77
+ keepalive_timeout 65;
78
+
79
+ types_hash_max_size 2048;
80
+
81
+ # server_tokens off;
82
+
83
+
84
+
85
+ # server_names_hash_bucket_size 64;
86
+
87
+ # server_name_in_redirect off;
88
+
89
+
90
+
91
+ include /etc/nginx/mime.types;
92
+
93
+ default_type application/octet-stream;
94
+
95
+
96
+
97
+ ##
98
+
99
+ # SSL Settings
100
+
101
+ ##
102
+
103
+
104
+
105
+ ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
106
+
107
+ ssl_prefer_server_ciphers on;
108
+
109
+
110
+
111
+ ##
112
+
113
+ # Logging Settings
114
+
115
+ ##
116
+
117
+
118
+
119
+ access_log /var/log/nginx/access.log;
120
+
121
+ error_log /var/log/nginx/error.log;
122
+
123
+
124
+
125
+ ##
126
+
127
+ # Gzip Settings
128
+
129
+ ##
130
+
131
+
132
+
133
+ gzip on;
134
+
135
+
136
+
137
+ # gzip_vary on;
138
+
139
+ # gzip_proxied any;
140
+
141
+ # gzip_comp_level 6;
142
+
143
+ # gzip_buffers 16 8k;
144
+
145
+ # gzip_http_version 1.1;
146
+
147
+ # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
148
+
149
+
150
+
151
+ ##
152
+
153
+ # Virtual Host Configs
154
+
155
+ ##
156
+
157
+
158
+
159
+ include /etc/nginx/conf.d/*.conf;
160
+
161
+ include /etc/nginx/sites-enabled/*;
162
+
163
+ }
164
+
165
+
166
+
167
+
168
+
169
+ #mail {
170
+
171
+ # # See sample authentication script at:
172
+
173
+ # # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
174
+
175
+ #
176
+
177
+ # # auth_http localhost/auth.php;
178
+
179
+ # # pop3_capabilities "TOP" "USER";
180
+
181
+ # # imap_capabilities "IMAP4rev1" "UIDPLUS";
182
+
183
+ #
184
+
185
+ # server {
186
+
187
+ # listen localhost:110;
188
+
189
+ # protocol pop3;
190
+
191
+ # proxy on;
192
+
193
+ # }
194
+
195
+ #
196
+
197
+ # server {
198
+
199
+ # listen localhost:143;
200
+
201
+ # protocol imap;
202
+
203
+ # proxy on;
204
+
205
+ # }
206
+
207
+ #}
208
+
209
+ ```
210
+
31
211
 
32
212
 
33
213
  ### 試したこと