Apache2 server not wotking - apache2

For some reason my apache2 has stopped working.
I have tried uninstalling it, the problem still remains the same.
Here's some commands and their results that I have tried which might help you:-
"sudo systemctl status apache2":-
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset:
Active: failed (Result: exit-code) since Sun 2020-06-21 12:56:28 IST; 7min ag
Docs: https://httpd.apache.org/docs/2.4/
Jun 21 12:56:21 kabir systemd[1]: Starting The Apache HTTP Server...
Jun 21 12:56:28 kabir apachectl[1086]: AH00558: apache2: Could not reliably dete
Jun 21 12:56:28 kabir apachectl[1086]: (98)Address already in use: AH00072: make
Jun 21 12:56:28 kabir apachectl[1086]: no listening sockets available, shutting
Jun 21 12:56:28 kabir apachectl[1086]: AH00015: Unable to open logs
Jun 21 12:56:28 kabir apachectl[1086]: Action 'start' failed.
Jun 21 12:56:28 kabir apachectl[1086]: The Apache error log may have more inform
Jun 21 12:56:28 kabir systemd[1]: apache2.service: Control process exited, code=
Jun 21 12:56:28 kabir systemd[1]: apache2.service: Failed with result 'exit-code
Jun 21 12:56:28 kabir systemd[1]: Failed to start The Apache HTTP Server.
"sudo systemctl restart apache2":-
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
netstat -an | grep ":80"
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 192.168.43.128:33944 117.18.237.29:80 TIME_WAIT
tcp 0 0 192.168.43.128:33864 117.18.237.29:80 ESTABLISHED
tcp 0 0 192.168.43.128:34524 23.217.53.84:80 ESTABLISHED
tcp 0 0 192.168.43.128:54364 172.217.166.163:80 ESTABLISHED
tcp 0 0 192.168.43.128:54206 172.217.166.163:80 TIME_WAIT
tcp 0 0 192.168.43.128:33946 117.18.237.29:80 ESTABLISHED
tcp 0 0 192.168.43.128:34522 23.217.53.84:80 ESTABLISHED
tcp6 0 0 :::80 :::* LISTEN
"sudo apachectl start":-
Invoking 'systemctl start apache2'.
Use 'systemctl status apache2' for more info.
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
Action 'start' failed.
The Apache error log may have more information.

Check your configuration as the error would indicate that you already have a listen directive to the same port.
sudo vim /etc/apache2/ports.conf [On Debian/Ubuntu]
sudo vim /etc/httpd/conf/httpd.conf [On RHEL/CentOS]
Check that you don't have a listen on the port you need.

Related

apache2 restart problem on ubuntu 20.04 LTS

I had installed nginx but now i uninstalled the nginx facing this problem
when i run command "system start apache2"
it through the massage run "journalctl -xeu apache2.service" to check error massage when i run the above command it give following massage
Oct 29 17:37:32 localhost apachectl[37192]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Oct 29 17:37:32 localhost apachectl[37192]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Oct 29 17:37:32 localhost apachectl[37192]: no listening sockets available, shutting down
Oct 29 17:37:32 localhost apachectl[37192]: AH00015: Unable to open logs
Oct 29 17:37:32 localhost apachectl[37189]: Action 'start' failed.
Oct 29 17:37:32 localhost apachectl[37189]: The Apache error log may have more information.
Oct 29 17:37:32 localhost systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
I am not able to start my apache2 server

Cannot start Apache2 server on RaspberryPi 4

I installed Apache2 on Raspberry Pi4 B but it is not starting. If anyone had the same issue, please let me know the solution.
Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2.service.
Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service → /lib/systemd/system/apache-htcacheclean.service.
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
invoke-rc.d: initscript apache2, action "start" failed.
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2021-06-07 21:07:32 EEST; 22ms ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 30140 ExecStart=/usr/sbin/apachectl start (code=exited, status=127)
Jun 07 21:07:32 raspberrypi systemd[1]: Starting The Apache HTTP Server...
Jun 07 21:07:32 raspberrypi apachectl[30140]: /usr/sbin/apachectl: 174: /usr/sbin/apachectl: /usr/sbin/apache2: not found
Jun 07 21:07:32 raspberrypi apachectl[30140]: Action 'start' failed.
Jun 07 21:07:32 raspberrypi apachectl[30140]: The Apache error log may have more information.
Jun 07 21:07:32 raspberrypi systemd[1]: apache2.service: Control process exited, code=exited, status=127/n/a
Jun 07 21:07:32 raspberrypi systemd[1]: apache2.service: Failed with result 'exit-code'.
Jun 07 21:07:32 raspberrypi systemd[1]: Failed to start The Apache HTTP Server.
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for systemd (241-7~deb10u4+rpi1) ...
Problem solved with:
sudo apt install --reinstall apache2-bin
sudo service apache2 start

Centos : Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : TCP Provider: Error code 0x2749

I have installed MSSSQL on Centos 7. Installation is completed but when I am a connection to the SQL via sqlcmd It is giving the following error.
[root#S*03****k ~]# sqlcmd -S 127.0.0.1 -U sa -P H*****3
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : TCP Provider: Error code 0x2749.
Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..
root#S*****k ~]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 699/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 793/master
tcp6 0 0 :::80 :::* LISTEN 704/httpd
tcp6 0 0 :::22 :::* LISTEN 699/sshd
Can anyone help?
After wasting so many days i have come to know that this happens due to Stopped SQL Service. I have tried to start but some how this is not get up.
Every time i checked the MSSQL service is failing i have over 5 GB memory on my virtual server.
r*****k:~# sudo systemctl status mssql-server
● mssql-server.service - Microsoft SQL Server Database Engine
Loaded: loaded (/lib/systemd/system/mssql-server.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Fri 2017-11-17 15:39:39 UTC; 1min 37s ago
Process: 4906 ExecStart=/opt/mssql/bin/sqlservr (code=exited, status=255)
Main PID: 4906 (code=exited, status=255)
Nov 17 15:39:39 SV0*****com systemd[1]: mssql-server.service: Unit entered failed state.
Nov 17 15:39:39 SV0*****com systemd[1]: mssql-server.service: Failed with result 'exit-code'.
Nov 17 15:39:39 SV0*****.com systemd[1]: mssql-server.service: Service hold-off time over, scheduling restart.
Nov 17 15:39:39 SV0*****.com systemd[1]: Stopped Microsoft SQL Server Database Engine.
Nov 17 15:39:39 SV0*****.com systemd[1]: mssql-server.service: Start request repeated too quickly.
Nov 17 15:39:39 SV0*****.com systemd[1]: Failed to start Microsoft SQL Server Database Engine.
Finally, i have created a new virtual machine and SQL Service is working fine. SQL Databases are working as expected.

"systemctl status apache2.service" error in starting apache2

root#kudo2:~# sudo systemctl restart apache2
Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
root#kudo2:~# systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Tue 2017-10-03 14:22:01 UTC; 3min 33s ago
Process: 17190 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
Oct 03 14:22:01 kudo2 apachectl[17190]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Oct 03 14:22:01 kudo2 apachectl[17190]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Oct 03 14:22:01 kudo2 apachectl[17190]: no listening sockets available, shutting down
Oct 03 14:22:01 kudo2 apachectl[17190]: AH00015: Unable to open logs
Oct 03 14:22:01 kudo2 apachectl[17190]: Action 'start' failed.
Oct 03 14:22:01 kudo2 apachectl[17190]: The Apache error log may have more information.
Oct 03 14:22:01 kudo2 systemd[1]: apache2.service: Control process exited, code=exited status=1
Oct 03 14:22:01 kudo2 systemd[1]: Failed to start The Apache HTTP Server.
Oct 03 14:22:01 kudo2 systemd[1]: apache2.service: Unit entered failed state.
Oct 03 14:22:01 kudo2 systemd[1]: apache2.service: Failed with result 'exit-code'.
root#kudo2:~#
Something else is already using port 80. Try starting apache on a different port or else find out what else is using port 80 and move/kill it.
You could run ss -tlnp|grep -w 80 as a superuser to see which proccess is listening on port 80. This process could be configured to listen on another port. This would free port 80 and allow apache to run.

Apache2 is not starting after apt upgrade

I updated Apache2 on my Rapsberry Pi (using: apt install apache2 --only-upgrade) and now it is not starting:
root#pi:/etc/apache2 # service apache2 start
Job for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details.
root#pi:/etc/apache2 # systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled)
Active: failed (Result: resources) since Sun 2017-02-05 16:19:48 CET; 28min ago
Feb 05 16:47:44 pi systemd[1]: Starting The Apache HTTP Server...
Feb 05 16:47:44 pi systemd[1]: apache2.service failed to run 'start' task: No such file or directory
Feb 05 16:47:44 pi systemd[1]: Failed to start The Apache HTTP Server.
Version of apache2:
Server version: Apache/2.4.25 (Raspbian)
Server built: 2017-01-25T22:59:26
apache2ctl -t shows:
Syntax OK
I tried disabling all virtual hosts (only default left) but it didn't change anything.
Output of just apache2:
[Mon Feb 06 01:25:09.079790 2017] [core:warn] [pid 2954] AH00111: Config variable ${APACHE_RUN_DIR} is not defined
apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot
I had the same issue after upgrading a Dockerfile from 14.04 to 17.04.
The solution for me was to manually add the apache directory in /var/run
So the fix was:
mkdir /var/run/apache2
The DefaultRuntimeDir was set to /var/run/apache2 but the folder was missing.

Resources