Error while starting Apache2

Error:  Restarting web server apache2 AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/sites-enabled/ (98)Address already in use: AH00072: makesock: could not bind to address [::]:80 (98)Address already in use: AH00072: makesock: could not bind to address [::]:80


Check any other web servers are running…. Like Tomcat, Nginx, if they are using same sockets, apache2 will not run and produce above error.

Please remove, if not necessary…..

$ sudo apt-get remove nginx nginx-common # Removes all but config files

$ sudo apt-get purge nginx nginx-common # Removes everything.

$ sudo apt-get autoremove  #After using any of the above commands, use this in order to remove dependencies used by nginx which are no longer required.

$ sudo systemctl enable apache2.service

$ sudo systemctl start apache2.service

$ sudo systemctl status apache2.service

apache2.service – LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
   Active: active (running) since Sun 2017-02-19 12:58:55 IST; 7h ago
     Docs: man:systemd-sysv-generator(8)
   CGroup: /system.slice/apache2.service
           ├─ 1417 /usr/sbin/apache2 -k start
           ├─ 1431 /usr/sbin/apache2 -k start
           ├─ 1432 /usr/sbin/apache2 -k start
           ├─ 1433 /usr/sbin/apache2 -k start
           ├─ 1434 /usr/sbin/apache2 -k start
           ├─ 1435 /usr/sbin/apache2 -k start
           ├─27148 /usr/sbin/apache2 -k start
           ├─27163 /usr/sbin/apache2 -k start
           ├─27164 /usr/sbin/apache2 -k start
           ├─27166 /usr/sbin/apache2 -k start
           └─27167 /usr/sbin/apache2 -k start

Feb 19 12:58:48 ubuntu systemd[1]: Starting LSB: Apache2 web server…
Feb 19 12:58:48 ubuntu apache2[1280]:  * Starting Apache httpd web server apache
Feb 19 12:58:55 ubuntu apache2[1280]:  *
Feb 19 12:58:55 ubuntu systemd[1]: Started LSB: Apache2 web server.

Now Apache2 server enabled and started without producing any errors.