Nginx를 시작할 수 없습니다

Nginx를 시작할 수 없습니다

저는 Arch Linux를 실행하고 있으며 다음을 실행할 때:

sudo systemctl start nginx.service

내 일기장에 다음과 같은 메시지가 떴습니다.

nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2019-05-15 11:17:03 BST; 45s ago
  Process: 1542 ExecStart=/usr/bin/nginx -g pid /run/nginx.pid; error_log stderr; (code=exited, status=1/FAILURE)

May 15 11:17:03 systemd[1]: Starting A high performance web server and a reverse proxy server...
May 15 11:17:03 nginx[1542]: 2019/05/15 11:17:03 [emerg] 1542#1542: a duplicate listen 0.0.0.0:80 in /etc/nginx/nginx.conf:42
May 15 11:17:03  systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
May 15 11:17:03  systemd[1]: nginx.service: Failed with result 'exit-code'.
May 15 11:17:03  systemd[1]: Failed to start A high performance web server and a reverse proxy server.

여기서 오류를 이해하지 못합니다. 어떻게 해결할 수 있나요?

고쳐 쓰다

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2019-05-15 11:36:36 BST; 9s ago
  Process: 1667 ExecStart=/usr/bin/nginx -g pid /run/nginx.pid; error_log stderr; (code=exited, status=1/FAILURE)

May 15 11:36:36  systemd[1]: Starting A high performance web server and a reverse proxy server...
May 15 11:36:36  nginx[1667]: 2019/05/15 11:36:36 [emerg] 1667#1667: getpwnam("www-data") failed in /etc/nginx/nginx.conf:3
May 15 11:36:36  systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
May 15 11:36:36  systemd[1]: nginx.service: Failed with result 'exit-code'.
May 15 11:36:36  systemd[1]: Failed to start A high performance web server and a reverse proxy server.

답변1

포트 80에서 수신 대기 중인 다른 항목이 있습니다. 다음 줄을 확인하세요.

duplicate listen 0.0.0.0:80

어떤 PID가 듣고 있는지 확인하려면 다음을 시도하십시오.

netstat -anp|grep :80

nginx 구성에 문제가 있는 경우 다음과 같은 최소 구성을 시도해 볼 수 있습니다.

daemon            on;
worker_processes  2;
user              www-data;
events {
    use           epoll;
    worker_connections  128;
}
error_log         logs/error.log info;
http {
    server_tokens off;
    include       mime.types;
    charset       utf-8;
    access_log    logs/access.log  combined;
    server {
        server_name   localhost;
        listen        *:80;
        error_page    500 502 503 504  /50x.html;
        location      / {
            root      html;
        }
    }
}

관련 정보