CentOS 7에서 HTTPD를 다시 시작할 수 없습니다.

CentOS 7에서 HTTPD를 다시 시작할 수 없습니다.

CentOS 7을 실행하는 인스턴스가 있습니다. 다시 시작하면 문제가 발생합니다 httpd.

내 구성이 제대로 작동하고 내 사이트가 원하는 대로 브로드캐스트됩니다. 게다가 명령을 실행하면 sudo apachectl configtest다시 돌아옵니다 Syntax OK.

하지만 다시 시작하면 httpd다음 상태 메시지를 따르지 않습니다.

● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2018-08-28 12:30:26 CEST; 6s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 9569 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 9568 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 9568 (code=exited, status=1/FAILURE)

Aug 28 12:30:26 vps httpd[9568]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Aug 28 12:30:26 vps httpd[9568]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Aug 28 12:30:26 vps httpd[9568]: no listening sockets available, shutting down
Aug 28 12:30:26 vps httpd[9568]: AH00015: Unable to open logs
Aug 28 12:30:26 vps systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Aug 28 12:30:26 vps kill[9569]: kill: cannot find process ""
Aug 28 12:30:26 vps systemd[1]: httpd.service: control process exited, code=exited status=1
Aug 28 12:30:26 vps systemd[1]: Failed to start The Apache HTTP Server.
Aug 28 12:30:26 vps systemd[1]: Unit httpd.service entered failed state.
Aug 28 12:30:26 vps systemd[1]: httpd.service failed.

httpd다시 시작할 때 다른 것이 작동하고 있다는 것을 알았습니다 . 그러므로 나는 netstat -tulpn | grep :80.

tcp        0      0 0.0.0.0:8060            0.0.0.0:*               LISTEN      2560/nginx: master  
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      2560/nginx: master  
tcp        0      0 127.0.0.1:8080          0.0.0.0:*               LISTEN      1434/unicorn master 
tcp        0      0 127.0.0.1:8082          0.0.0.0:*               LISTEN      1307/sidekiq 5.1.3 

Nginx위의 결과는 시스템에 설치 하지 않았고 which nginx아무것도 반환하지 않았기 때문에 혼란스럽습니다 .

그러나 인스턴스를 재부팅하면 httpd의도한 대로 작동합니다.

문제를 해결하려면 어떻게 해야 합니까?

답변1

좋아요, 수수께끼가 풀렸습니다. Gerald Schneider에게 감사드립니다.(트로이목마는 아니었지만 다행히)

실행을 통해 ps -Af | grep $pid더 많은 통찰력을 얻을 수 있었고 GitLab이 주목받았습니다.(뭔가 의심스러운 점이 있다는 것을 알았지만 문제의 근본 원인을 파악하고 제대로 식별할 수 없었습니다.)

httpd와 충돌했습니다 gitlab. 일단 실행 sudo gitlab-ctl stop하고 다시 시작을 시도하면 httpd모든 것이 평소와 같이 작동했습니다.

또한,이 질문Apache에 대한 더 많은 통찰력을 제공합니다 - GitLab - Nginx 딜레마.(그리고 첫 번째 언급은 Apache와 GitLab이 포트 80에서 모순된다는 것입니다.])

답변2

systemctl명령을 사용하여 실행 중인 서비스를 식별 할 수 있습니다 .

귀하의 경우systemctl list-unit-files | grep nginx

systemctl list-unit-files | grep nginx
nginx-nr-agent.service                 generated
nginx.service                          enabled  

그런 다음 다음 명령을 사용하여 실행 중인 서비스에 대한 자세한 정보를 찾을 수 있습니다.systemctl status servicename

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-08-28 15:03:08 EEST; 47min ago
     Docs: man:nginx(8)
  Process: 1455 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
  Process: 1460 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 1458 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 1462 (nginx)
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/nginx.service
           ├─1462 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           └─1463 nginx: worker process

아마도 ExecStop과 ExecStart는 바이너리 위치를 식별하는 데 도움이 될 것입니다.

답변3

master는 Linux 서버의 postfix에 의해 사용됩니다. 다음 명령으로 postfix를 중지해 보십시오.

/sbin/service postfix stop

또한 구성에 postfix가 필요하지 않은 경우 다음 명령을 사용하여 서버를 재부팅할 때 postfix가 다시 시작되지 않도록 할 수 있습니다.

chkconfig postfix off

또한 오류를 통해 0.0.0.0:80에서 httpd를 시작하려고 한다는 것이 분명해졌습니다. 보다 구체적인 오류가 발생하는 대신 httpd.conf 파일의 IP 주소를 사용해 보십시오.

이제 httpd 서비스를 중지했다가 다시 시작해 보십시오.

관련 정보