본문으로 바로가기

참고 자료: https://askubuntu.com/questions/629995/apache-not-able-to-restart

 

Apache not able to restart

Trying to restart apache from terminal using following command: sudo service apache2 restart when executing that command getting below error: Job for apache2.service failed. See "systemctl status

askubuntu.com

apache2 같은 경우

 

다음과 같이 에러나 나면서 실행이 안될 수 있습니다.


● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2019-05-27 15:26:18 KST; 37ms ago
  Process: 4183 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

 5월 27 15:26:18 ns systemd[1]: Starting The Apache HTTP Server...
 5월 27 15:26:18 ns apachectl[4183]: apache2: Could not open configuration file /etc/apache2/apache2.conf: No such file or directory
 5월 27 15:26:18 ns apachectl[4183]: Action 'start' failed.
 5월 27 15:26:18 ns apachectl[4183]: The Apache error log may have more information.
 5월 27 15:26:18 ns systemd[1]: apache2.service: Control process exited, code=exited status=1
 5월 27 15:26:18 ns systemd[1]: Failed to start The Apache HTTP Server.
 5월 27 15:26:18 ns systemd[1]: apache2.service: Unit entered failed state.
 5월 27 15:26:18 ns systemd[1]: apache2.service: Failed with result 'exit-code'.

 

이런경우, 삭제 후 재설치 해야 하는데, 그 방법도 단순히 apt-get  install, apt-get remove 로는 되지 않습니다.

 

The problem is because some configuration files are deleted, you have to reinstall it.

 

REINSTALL APACHE2:

 

To replace configuration files that have been deleted, without purging the package, you can do:

 

sudo apt-get -o DPkg::Options::="--force-confmiss" --reinstall install apache2

 

To fully remove the apache2 config files, you should:

 

sudo apt-get purge apache2

 

which will then let you reinstall it in the usual way with:

 

sudo apt-get install apache2

 

Purge is required to remove all the config files - if you delete the config files but only remove the package, then this is remembered & missing config files are not reinstalled by default.

 

 


댓글을 달아 주세요