Question

Error in restart Apache2 on Ubuntu server

hi, i can’t restart apache2. I tried to check the status whit

systemctl status apache2.service

and the response is

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Thu 2021-01-07 17:37:34 UTC; 18min ago
  Process: 2022 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Jan 07 17:37:34 wealdhy apachectl[2022]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Jan 07 17:37:34 wealdhy apachectl[2022]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Jan 07 17:37:34 wealdhy apachectl[2022]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Jan 07 17:37:34 wealdhy apachectl[2022]: no listening sockets available, shutting down
Jan 07 17:37:34 wealdhy apachectl[2022]: AH00015: Unable to open logs
Jan 07 17:37:34 wealdhy apachectl[2022]: Action 'start' failed.
Jan 07 17:37:34 wealdhy apachectl[2022]: The Apache error log may have more information.
Jan 07 17:37:34 wealdhy systemd[1]: apache2.service: Control process exited, code=exited status=1
Jan 07 17:37:34 wealdhy systemd[1]: apache2.service: Failed with result 'exit-code'.
Jan 07 17:37:34 wealdhy systemd[1]: Failed to start The Apache HTTP Server.

then i check the error log and found this

Jan 07 17:55:19 wealdhy sshd[2809]: Failed password for root from 36.152.38.149 port 55462 ssh2
Jan 07 17:55:19 wealdhy kernel: [UFW BLOCK] IN=eth0 OUT= MAC=ca:7c:d5:fc:c6:f1:fe:00:00:00:01:01:08:00 SRC=212.91.113.201 DST=178.128.195.246 LEN=59 TOS=0x00 PREC=0x00 TTL=52 ID=7309 PROTO=UDP SPT=50744 DPT=53 LEN=39
Jan 07 17:55:19 wealdhy kernel: [UFW BLOCK] IN=eth0 OUT= MAC=ca:7c:d5:fc:c6:f1:fe:00:00:00:01:01:08:00 SRC=212.91.113.201 DST=178.128.195.246 LEN=59 TOS=0x00 PREC=0x00 TTL=52 ID=7310 PROTO=UDP SPT=40505 DPT=53 LEN=39
Jan 07 17:55:20 wealdhy kernel: [UFW BLOCK] IN=eth0 OUT= MAC=ca:7c:d5:fc:c6:f1:fe:00:00:00:01:01:08:00 SRC=212.91.113.201 DST=178.128.195.246 LEN=71 TOS=0x00 PREC=0x00 TTL=52 ID=7696 PROTO=UDP SPT=55060 DPT=53 LEN=51
Jan 07 17:55:20 wealdhy kernel: [UFW BLOCK] IN=eth0 OUT= MAC=ca:7c:d5:fc:c6:f1:fe:00:00:00:01:01:08:00 SRC=212.91.113.201 DST=178.128.195.246 LEN=71 TOS=0x00 PREC=0x00 TTL=53 ID=7698 PROTO=UDP SPT=58932 DPT=53 LEN=51
Jan 07 17:55:20 wealdhy kernel: [UFW BLOCK] IN=eth0 OUT= MAC=ca:7c:d5:fc:c6:f1:fe:00:00:00:01:01:08:00 SRC=212.91.113.200 DST=178.128.195.246 LEN=71 TOS=0x00 PREC=0x00 TTL=52 ID=58001 PROTO=UDP SPT=41859 DPT=53 LEN=51
Jan 07 17:55:38 wealdhy sshd[2818]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=202.153.37.194  user=root
Jan 07 17:55:39 wealdhy kernel: [UFW BLOCK] IN=eth0 OUT= MAC=ca:7c:d5:fc:c6:f1:fe:00:00:00:01:01:08:00 SRC=212.91.113.208 DST=178.128.195.246 LEN=71 TOS=0x00 PREC=0x00 TTL=52 ID=2213 PROTO=UDP SPT=40031 DPT=53 LEN=51
Jan 07 17:55:41 wealdhy sshd[2818]: Failed password for root from 202.153.37.194 port 43646 ssh2
Jan 07 17:55:41 wealdhy sshd[2818]: Received disconnect from 202.153.37.194 port 43646:11: Bye Bye [preauth]
Jan 07 17:55:41 wealdhy sshd[2818]: Disconnected from authenticating user root 202.153.37.194 port 43646 [preauth]
Jan 07 17:55:46 wealdhy sshd[2822]: Invalid user halt from 185.156.74.65 port 12420
Jan 07 17:55:46 wealdhy sshd[2822]: pam_unix(sshd:auth): check pass; user unknown
Jan 07 17:55:46 wealdhy sshd[2822]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=185.156.74.65
Jan 07 17:55:48 wealdhy sshd[2822]: Failed password for invalid user halt from 185.156.74.65 port 12420 ssh2
Jan 07 17:55:48 wealdhy sshd[2822]: Connection closed by invalid user halt 185.156.74.65 port 12420 [preauth]
Jan 07 17:55:55 wealdhy sshd[2824]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=121.162.235.166  user=root
Jan 07 17:55:57 wealdhy kernel: [UFW BLOCK] IN=eth0 OUT= MAC=ca:7c:d5:fc:c6:f1:fe:00:00:00:01:01:08:00 SRC=45.146.167.16 DST=178.128.195.246 LEN=40 TOS=0x00 PREC=0x00 TTL=249 ID=38497 PROTO=TCP SPT=48688 DPT=63398 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 17:55:57 wealdhy sshd[2824]: Failed password for root from 121.162.235.166 port 37972 ssh2
Jan 07 17:56:10 wealdhy kernel: [UFW BLOCK] IN=eth0 OUT= MAC=ca:7c:d5:fc:c6:f1:fe:00:00:00:01:01:08:00 SRC=79.124.62.110 DST=178.128.195.246 LEN=40 TOS=0x00 PREC=0x00 TTL=248 ID=41381 PROTO=TCP SPT=55452 DPT=40293 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 17:56:12 wealdhy kernel: [UFW BLOCK] IN=eth0 OUT= MAC=ca:7c:d5:fc:c6:f1:fe:00:00:00:01:01:08:00 SRC=79.124.62.110 DST=178.128.195.246 LEN=40 TOS=0x00 PREC=0x00 TTL=248 ID=30390 PROTO=TCP SPT=55452 DPT=33964 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 17:56:14 wealdhy kernel: [UFW BLOCK] IN=eth0 OUT= MAC=ca:7c:d5:fc:c6:f1:fe:00:00:00:01:01:08:00 SRC=195.54.161.151 DST=178.128.195.246 LEN=40 TOS=0x00 PREC=0x00 TTL=249 ID=32546 PROTO=TCP SPT=48798 DPT=45629 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 17:56:21 wealdhy sshd[2831]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=51.77.201.36  user=root
Jan 07 17:56:24 wealdhy sshd[2831]: Failed password for root from 51.77.201.36 port 37568 ssh2
Jan 07 17:56:24 wealdhy sshd[2831]: Received disconnect from 51.77.201.36 port 37568:11: Bye Bye [preauth]
Jan 07 17:56:24 wealdhy sshd[2831]: Disconnected from authenticating user root 51.77.201.36 port 37568 [preauth]

Before today everything was fine.

Anyone have any idea what that means (and how i can fix it) ?

Thanks in advance Francesco

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Thanks!

It seems like ngnix was active somehow

Domain/Subdomain name: ^Croot@wealdhy:~# netstat -tulpen | grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN                                                                                  0          18923      926/nginx: master p
tcp6       0      0 :::80                   :::*                    LISTEN                                                                                  0          18924      926/nginx: master p

i stopped ngnix and restarted apache

thanks Francesco

Hi @ffabietti78,

It seems like you have something listening on port 80 already:

Jan 07 17:37:34 wealdhy apachectl[2022]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Jan 07 17:37:34 wealdhy apachectl[2022]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80

What I can suggest you is to see what it is and take it from there. In order to see what is listening on that port, you can execute the command

netstat -tulpen | grep 80

Regards, KFSys