failed to restart apache2.service unit not found. centos 7 code example
Example: Failed to restart apache2.service: Unit not found.
You are using different service of apache.
run this if you are using the same service.
systemctl restart httpd
<----------------- Or ------------------>
apachectl restart