質問編集履歴

2

補足

2020/11/11 14:17

投稿

kavvano
kavvano

スコア47

title CHANGED
File without changes
body CHANGED
@@ -1,6 +1,6 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
- Nginxを起動させたいです。
3
+ Railsアプリを動かすために、Nginxを起動させたいです。
4
4
  設定の記述等は完了しています。
5
5
 
6
6
  ### 発生している問題・エラーメッセージ

1

文字が消えていた

2020/11/11 14:17

投稿

kavvano
kavvano

スコア47

title CHANGED
File without changes
body CHANGED
@@ -1,34 +1,69 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
- Nginxを起動させたい
3
+ Nginxを起動させたいです。
4
+ 設定の記述等は完了しています。
4
5
 
5
6
  ### 発生している問題・エラーメッセージ
6
- `sudo systemctl start nginx`で、Nginxを起動させようとしているが以下が表示され起動できない。
7
+ `sudo systemctl start nginx`で、Nginxを起動させようとしているが以下が表示され起動できない。
7
8
  ```
8
9
  Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
10
+
11
+ *****<翻訳>*****
12
+ 制御プロセスがエラーコードで終了したため、nginx.serviceのジョブが失敗しました。 詳細については、「systemctlstatusnginx.service」および「journalctl-xe」を参照してください。
9
13
  ```
10
- 制御プロセスがエラーコードで終了したため、nginx.serviceのジョブが失敗しました。 詳細については、「systemctlstatusnginx.service」および「journalctl-xe」を参照してください。
11
14
 
12
- ### 該当のソースコード
15
+ ### 試したこと
16
+ ①`systemctlstatusnginx.service`を実行し、内容を確認
17
+ ```
18
+ ● nginx.service - The nginx HTTP and reverse proxy server
19
+ Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
20
+ Active: failed (Result: exit-code) since 水 2020-11-11 13:28:43 UTC; 4min 59s ago
21
+ Process: 16766 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
22
+ Process: 16763 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
23
+ Process: 16762 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
13
24
 
25
+ 11月 11 13:28:41 ip-10-0-10-10.ap-northeast-1.compute.internal nginx[16766]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
26
+ 11月 11 13:28:42 ip-10-0-10-10.ap-northeast-1.compute.internal nginx[16766]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
27
+ 11月 11 13:28:42 ip-10-0-10-10.ap-northeast-1.compute.internal nginx[16766]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
28
+ 11月 11 13:28:42 ip-10-0-10-10.ap-northeast-1.compute.internal nginx[16766]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
29
+ 11月 11 13:28:42 ip-10-0-10-10.ap-northeast-1.compute.internal nginx[16766]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
30
+ 11月 11 13:28:43 ip-10-0-10-10.ap-northeast-1.compute.internal nginx[16766]: nginx: [emerg] still could not bind()
31
+ 11月 11 13:28:43 ip-10-0-10-10.ap-northeast-1.compute.internal systemd[1]: nginx.service: control process exited, code=exited status=1
32
+ 11月 11 13:28:43 ip-10-0-10-10.ap-northeast-1.compute.internal systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
33
+ 11月 11 13:28:43 ip-10-0-10-10.ap-northeast-1.compute.internal systemd[1]: Unit nginx.service entered failed state.
14
- ```ここに言語名を入力
34
+ 11月 11 13:28:43 ip-10-0-10-10.ap-northeast-1.compute.internal systemd[1]: nginx.service failed.
15
- ソースコード
16
35
  ```
36
+ 赤字だった14行目の"Failed to start The nginx HTTP and reverse proxy server."について調べたら、`nginx -t`をやってみると良いようだったので、そちらを実行。
17
37
 
18
- ### 試したこと
19
- `nginx -t`
38
+ `nginx -t`でエラー内容の確認を実施
20
39
  ```
21
40
  nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
22
41
  2020/11/11 13:35:07 [warn] 16792#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:5
23
42
  nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
24
43
  2020/11/11 13:35:07 [emerg] 16792#0: open() "/run/nginx.pid" failed (13: Permission denied)
25
44
  nginx: configuration file /etc/nginx/nginx.conf test failed
45
+
26
- ```
46
+ **********<翻訳>**********
27
47
  nginx:[アラート]はエラーログファイルを開くことができませんでした:open() "/var/log/nginx/error.log"が失敗しました(13:アクセスが拒否されました)
28
- 2020/11/11 13:35:07 [警告] 16792#0:「user」ディレクティブは、マスタープロセスがスーパーユーザー権限で実行されている場合にのみ意味があり、/ etc / nginx / nginx.conf:5では無視されます
48
+ 2020/11/11 13:35:07 [警告] 16792#0:「user」ディレクティブは、マスタープロセスがスーパーユーザー権限で実行されている場合にのみ意味があり、/etc/nginx/nginx.conf:5では無視されます
29
49
  nginx:構成ファイル/etc/nginx/nginx.conf構文は問題ありません
30
50
  2020/11/11 13:35:07 [emerg] 16792#0:open() "/run/nginx.pid"が失敗しました(13:アクセスが拒否されました)
31
51
  nginx:構成ファイル/etc/nginx/nginx.confテストが失敗しました
32
- ### 補足情報(FW/ツールのバージョンなど)
52
+ ```
33
53
 
54
+ ③上のエラー内容より、"/var/log/nginx/error.log"と"/run/nginx.pid"はとりあえず権限を"777"へ変更しています。
55
+ "/etc/nginx/nginx.conf"は何が問題なのかわかりません。5行目は、"user nginx;"ですが何が問題なのでしょうか?
56
+ ```
57
+ </etc/nginx/nginx.conf>
58
+ # For more information on configuration, see:
59
+ # * Official English Documentation: http://nginx.org/en/docs/
60
+ # * Official Russian Documentation: http://nginx.org/ru/docs/
61
+
62
+ user nginx;
63
+ worker_processes auto;
64
+ error_log /var/log/nginx/error.log;
65
+ pid /run/nginx.pid;
66
+ 〜省略〜
67
+ ```
34
- ここにり詳細な情報記載ださい。
68
+ ければご回答よろしくお願いたします
69
+ こんなことやってみればとか、自分はちょっと違うけどこんなことありました的な内容でも構いませんのでお願いいたします。