Doccano がポート 80 でサービスを依頼すると、「('0.0.0.0', 80) に接続できません。」: 問題は何ですか?

Doccano がポート 80 でサービスを依頼すると、「('0.0.0.0', 80) に接続できません。」: 問題は何ですか?

私は使うドカノUbuntu 22.04で。

Doccanoにポート80を提供するように依頼するとエラーが発生します。 "Can't connect to ('0.0.0.0', 80)"何が問題ですか?

Doccanoにポート8000​​を提供するように頼むとうまくいきます。

完全なエラーメッセージ:

(doccanopy310) ubuntu@ip-172-30-33-321:~$ doccano webserver --port 80
[2023-08-12 00:16:09 +0000] [36905] [INFO] [django_drf_filepond.apps::ready::61] App init: no django-storages backend configured, using default (local) storage backend if set, otherwise you need to manage file storage independently of this app.
Starting server with port 80.
[2023-08-12 00:16:09 +0000] [36905] [INFO] Starting gunicorn 20.1.0
[2023-08-12 00:16:09 +0000] [36905] [ERROR] Retrying in 1 second.
[2023-08-12 00:16:10 +0000] [36905] [ERROR] Retrying in 1 second.
[2023-08-12 00:16:11 +0000] [36905] [ERROR] Retrying in 1 second.
[2023-08-12 00:16:12 +0000] [36905] [ERROR] Retrying in 1 second.
[2023-08-12 00:16:13 +0000] [36905] [ERROR] Retrying in 1 second.
[2023-08-12 00:16:14 +0000] [36905] [ERROR] Can't connect to ('0.0.0.0', 80)
(doccanopy310) ubuntu@ip-172-30-33-321:~$

再現するには:AWS EC2インスタンスを起動し、次のコマンドを実行します。

Doccanoをインストールしました。

# Install conda
wget https://repo.anaconda.com/archive/Anaconda3-2023.03-1-Linux-x86_64.sh 
bash Anaconda3-2023.03-1-Linux-x86_64.sh -b
if ! [[ $PATH =~ "$HOME/anaconda3/bin" ]]; then
  PATH="$HOME/anaconda3/bin:$PATH"
fi
conda init bash
source ~/.bashrc 

# create conda env and install doccano
conda create -n doccanopy310 python=3.10 anaconda
conda activate doccanopy310
pip install doccano

ドッカノを始めるために公式文書)。私は走る:

# Initialize database. First time only.
doccano init
# Create a super user. First time only.
doccano createuser --username admin --password pass
# Start a web server.
doccano webserver --port 80

別の端末で実行してください。

# Start the task queue to handle file upload/download.
doccano task

Doccanoにポート8000​​を提供するように頼むとうまくいきます。

(doccanopy310) ubuntu@ip-172-30-33-321:~$ doccano webserver --port 8000
[2023-08-12 00:21:53 +0000] [37206] [INFO] [django_drf_filepond.apps::ready::61] App init: no django-storages backend configured, using default (local) storage backend if set, otherwise you need to manage file storage independently of this app.
Starting server with port 8000.
[2023-08-12 00:21:53 +0000] [37206] [INFO] Starting gunicorn 20.1.0
[2023-08-12 00:21:53 +0000] [37206] [INFO] Listening at: http://0.0.0.0:8000 (37206)
[2023-08-12 00:21:53 +0000] [37206] [INFO] Using worker: sync
[2023-08-12 00:21:53 +0000] [37207] [INFO] Booting worker with pid: 37207
[2023-08-12 00:21:53 +0000] [37208] [INFO] Booting worker with pid: 37208
[2023-08-12 00:21:53 +0000] [37209] [INFO] Booting worker with pid: 37209
[2023-08-12 00:21:54 +0000] [37210] [INFO] Booting worker with pid: 37210
[2023-08-12 00:21:54 +0000] [37211] [INFO] Booting worker with pid: 37211

見ませんでした。ポート80を使用するすべてのプログラム:

debug to see which ports are being used: From within the machine netstat -ntlp / netstat -nulp will show all open TCP / UDP ports (and associated programs) respectively.
(doccanopy310) ubuntu@ip-172-30-33-321:~$ netstat -nulp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
udp        0      0 127.0.0.53:53           0.0.0.0:*                           -
udp        0      0 172.30.33.321:68        0.0.0.0:*                           -
udp        0      0 127.0.0.1:323           0.0.0.0:*                           -
udp6       0      0 ::1:323                 :::*                                -

(doccanopy310) ubuntu@ip-172-30-33-321:~$ netstat -ntlp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      37206/python
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
(doccanopy310) ubuntu@ip-172-30-33-321:~$

環境:

  • Ubuntu 22.04.2 LTS(GNU/Linux 5.15.0-1039-aws x86_64))。

ベストアンサー1

一般ユーザーとして実行しています。ルートのみプロセスを開き、1024未満のポートでリッスンできます。ルートとして実行するか、ポート1025以降を使用してからApacheまたはNginxを使用してポート80にリダイレクトする必要がありますが、これを行うには、ルートが設定ファイルを作成/編集してデーモンを再起動する必要があります。

おすすめ記事