Apache2 on starts then immediately fails on debian9 - apache

when starting Apache2 on my debian 9 (stretch) it starts then immediately fails.
there is nothing in the error log.
the syslog says this.
Aug 4 11:56:31 debian systemd[1]: Starting The Apache HTTP Server...
Aug 4 11:56:38 debian systemd[1]: Started The Apache HTTP Server.
Aug 4 11:56:38 debian systemd[1]: apache2.service: Main process exited, code=killed, status=11/SEGV
Aug 4 11:56:38 debian apachectl[2414]: httpd (no pid file) not running
Aug 4 11:56:38 debian systemd[1]: apache2.service: Unit entered failed state.
Aug 4 11:56:38 debian systemd[1]: apache2.service: Failed with result 'signal'.
Aug 4 11:56:38 debian systemd[1]: apache2.service: Service hold-off time over, scheduling restart.
Aug 4 11:56:38 debian systemd[1]: Stopped The Apache HTTP Server.
Any have any ideas on how I can trace exactly what is causing my server to shut down.
I have done a conf test and all confs are fine.

Can you send the result the command below? Maybe if it fail show something more.
# service apache2 status
Well, if you see the port number, you can check any possible conflicts.
Try the command:
# lsof -i :"port_number"
"port_number" must be the port your apache service are using. This command will listing the programs that are use it. If there is another than apache2, you find the problem. Stop the other one service or program and restart apache2.
If the port that apache2 is free, and the error continue, show the content of status of apache2 service.

Related

Service Unavailable. Apache2 centos 7

I have installed apache in centos 7. PHP version 7.1 and php-fpm. I had restarted system. Afterward, apache is working but once i access any file it show me below error.
503 service Unavailable
Service Unavailable
The server is temporarily unable to service your request due to
maintenance downtime or capacity problems. Please try again later.
Apache log:
[Tue Nov 13 18:25:25.171750 2018] [proxy:error] [pid 13059]
(111)Connection refused: AH00957: FCGI: attempt to connect to
127.0.0.1:6000 (127.0.0.1) failed
Please help me to fix this issue.
Finally i got solution of the error. I just uninstall PHP-fpm and used standard PHP 7.1 version and restarted HTTPD services. Its working fine.

Apache does not run

I have a Centos 7 server with the names of one to play and another to use with Apache. Everything works correctly until I enable https for both domains. As of this moment, apache will not know if you have enabled the gitlab server.
-I get the following to the journalctl -xe exercise:
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat
--
-- A new session with the ID 1806 has been created for the user root.
--
-- The leading process of the session is 21782.
sep 25 17:54:07 centOS sshd[21782]: pam_unix(sshd:session): session opened for user root by (uid=0)
sep 25 17:54:07 centOS systemd[1]: Started Session 1806 of user root.
-- Subject: Unit session-1806.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-1806.scope has finished starting up.
--
-- The start-up result is done.
sep 25 17:54:07 centOS systemd[1]: Starting Session 1806 of user root.
-- Subject: Unit session-1806.scope has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-1806.scope has begun starting up.
sep 25 17:54:32 centOS polkitd[488]: Registered Authentication Agent for unix-process:21855:10383292 (system bus name :1.3661 [/usr/bin/pkttyagent --notify-fsep 25 17:54:32 centOS systemd
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
sep 25 17:54:32 centOS httpd[21861]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
sep 25 17:54:32 centOS httpd[21861]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
sep 25 17:54:32 centOS httpd[21861]: no listening sockets available, shutting down
sep 25 17:54:32 centOS httpd[21861]: AH00015: Unable to open logs
sep 25 17:54:32 centOS systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
sep 25 17:54:32 centOS kill[21863]: kill: cannot find process ""
sep 25 17:54:32 centOS systemd[1]: httpd.service: control process exited, code=exited status=1
sep 25 17:54:32 centOS systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
sep 25 17:54:32 centOS systemd[1]: Unit httpd.service entered failed state.
sep 25 17:54:32 centOS systemd[1]: httpd.service failed.
sep 25 17:54:32 centOS polkitd[488]: Unregistered Authentication Agent for unix-process:21855:10383292 (system bus name :1.3661, object path /org/freedesktoplines 5302-5347/5347 (END)
It looks like that the port 80 is already in use from an other application. Go to your httpd.conf file in Apache and try to change to port Listen 80 just to find out if thats the issue. Tell me if this works.
Change from:
Listen 80
ServerName localhost:80
To:
Listen 8012
ServerName localhost:8012
Enter: http://localhost:8012 in browser to check if this works for you.

404 Not Found on previously working website

I previously had a website that I was hosting personally on a ubuntu server 16.04 LTS, sort of just a project to show that I knew what I was doing. (Turns out I don't have a clue!)
The site was/is structured such that I have a landing page located in /var/www/html. a second directory located in /var/www/agv-guru and a third directory located in /var/www/owncloud/.
I have an alias set up for both owncloud and the agv-guru folder and everything was working properly for months.
For whatever reason I decided that instead of having a separate server (raspberry-pi) running pi-hole, I would go ahead and install it on my existing server. I quickly realized that my website was down and I un-installed Pi-Hole, which may or may not have made matters worse.
I'm looking for help troubleshooting this one as I am not entirely sure whats going on.
Here is what i know so far.
The folders are still located in the same directory just like before.
The folders are owned by www-data.
The Document Root is /var/www/html.
The Alias is still set up for both agv-guru and owncloud.
/var/www/html/index.html still runs as normal with the exception of one photo not loading that was being pulled from the agv-guru folder.
Webserver is Apache2
Edit 1.
I just cleared the logs hoping to just reload the service but I get an error.
usr#Server:/var/log/apache2# service apache2 reload
apache2.service is not active, cannot reload.
So I ran the status as shown below.
usr#Server:/var/log/apache2# service apache2 status
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: inactive (dead) since Tue 2017-10-17 22:16:29 CDT; 58s ago
Docs: man:systemd-sysv-generator(8)
Process: 14594 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 14577 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
Oct 17 22:16:29 Server apache2[14577]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Oct 17 22:16:29 Server apache2[14577]: no listening sockets available, shutting down
Oct 17 22:16:29 Server apache2[14577]: AH00015: Unable to open logs
Oct 17 22:16:29 Server apache2[14577]: Action 'start' failed.
Oct 17 22:16:29 Server apache2[14577]: The Apache error log may have more information.
Oct 17 22:16:29 Server apache2[14577]: *
Oct 17 22:16:29 Server apache2[14594]: * Stopping Apache httpd web server apache2
Oct 17 22:16:29 Server apache2[14594]: *
Oct 17 22:16:29 Server systemd[1]: Started LSB: Apache2 web server.
Oct 17 22:16:36 Server systemd[1]: apache2.service: Unit cannot be reloaded because it is inactive.
Edit 2
sudo netstat -natp | grep ':80.*LISTEN'
Yields
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
1636/lighttpd
Solution
With sborsky's help the solution was found.
When installing pi-hole lighttpd was also installed. This webserver was occupying the port preventing apache from running.

apache not starting and does not have proper message on logs

I have tried to configure apache using puppet. When I try to start apache it is failing with out any proper error message. I am not figure out why it is failing. I tried executing the below commands it just say failed to start and does not show any specific reason why it failed to start. Could you please let me know how to figure out what is happening? I am attaching my log file below.
systemctl status httpd.service
journalctl -xe
Aug 15 22:56:03 hostname systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has begun starting up.
Aug 15 22:56:03 hostname httpd[18999]: no listening sockets available, shutting down
Aug 15 22:56:03 hostname httpd[18999]: AH00015: Unable to open logs
Aug 15 22:56:03 hostname systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Aug 15 22:56:03 hostname kill[19001]: kill: cannot find process ""
Aug 15 22:56:03 hostname audispd[414]: node=hostname type=SERVICE_START msg=audit(1471316163.292:57410): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=
Aug 15 22:56:03 hostname systemd[1]: httpd.service: control process exited, code=exited status=1
Aug 15 22:56:03 hostname systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Aug 15 22:56:03 hostname systemd[1]: Unit httpd.service entered failed state.
Aug 15 22:56:03 hostname systemd[1]: httpd.service failed.
Aug 15 22:56:03 hostname polkitd[532]: Unregistered Authentication Agent for unix-process:18984:32063862 (system bus name :1.15792, object path /org/freedesktop/P
I think your best hint is
Aug 15 22:56:03 hostname httpd[18999]: no listening sockets available, shutting down
Looks like another process is listening on the socket that tomcat is trying to listen on, which is 8080 by default or you can check conf to see what is set
You can use command like
lsof -i TCP |grep 8080
To get process id of what is listening on that port and track it down in top or whatever
I was able to figure out the problem, the default configuration of puppet has commented out the listen port in httpd.conf and added a port.conf. But as i have not explicitly configured the listen port, apache did not had a default port to listen. I have configured the port and it started working.

Apache Server Won't Start in MAMP

Apache server won't start when in MAMP. Here are the error logs:
[Wed Aug 01 21:07:34 2012] [notice] Digest: generating secret for digest authentication ...
[Wed Aug 01 21:07:34 2012] [notice] Digest: done
[Wed Aug 01 21:07:34 2012] [notice] Apache/2.0.63 (Unix) PHP/5.3.2 DAV/2 configured -- resuming normal operations
[Wed Aug 01 21:08:00 2012] [notice] caught SIGTERM, shutting down
[Wed Aug 01 21:08:01 2012] [notice] Digest: generating secret for digest authentication ...
[Wed Aug 01 21:08:01 2012] [notice] Digest: done
[Wed Aug 01 21:08:01 2012] [notice] Apache/2.0.63 (Unix) PHP/5.3.2 DAV/2 configured -- resuming normal operations
[Wed Aug 01 21:08:51 2012] [notice] caught SIGTERM, shutting down
I don't think I did anything our of the ordinary except create a new folder in htdocs. Any suggestions?
My solution:
in /Applications/Mamp/Library/bin, find the file envvars and rename it to _envvars.
now it works.
I encountered this same issue with the same log output above, but did not need to reinstall MAMP to solve the issue in my case. When I encountered this error it was related to one of the hosts I had set up. Click the Hosts tab and see if any of your hosts appear in red:
The host in red required SSL certificates. In the configuration I did not have valid references to the required certificates after I had altered the file structure of my application. After fixing this issue and applying changes the host was no longer highlighted in red, and I was able to start Apache through MAMP.
Additionally, you can ensure that the problem doesn't have to do with your Apache client itself by running this command in terminal:
sudo /Applications/MAMP/Library/bin/apachectl restart
OR
sudo /Applications/MAMP\ PRO/Library/bin/apachectl restart
If you are able to start Apache in terminal, you have ruled out that you have an error with MAMP's Apache client itself.
Change the name of the file envvars to _envvars in /Applications/MAMP/Library/bin , thats it .
Instead of reinstalling mamp I did the following:
1. Moved back to default mamp ports
2. Started mamp
3. Stopped mamp
4. Went back to ports 80 443 3306
and it started working.
Just reinstalled MAMP and changed the ports. Not sure what the problem was, but it's fixed now.
If your existing MAMP PRO suddenly won't start Apache anymore, then it might be an error in vhosts settings which is not visible.
There is often no indication in apache_error.log - it just comes up with the message.
Apache wasn't able to start. Please check log for more information.
In my case it was a wrong path in Customized virtual host settings such as
Include /path/to/project/rewrite.conf
Vhost config is saved in ~/Library/Application Support/appsolute/MAMP PRO/httpd.conf so you can check the settings there.
Solution: MAMP 4 - Dec 2017, macOS High Sierra
Had this issue with MAMP Pro 3.4.1 so i paid for a new license so i could upgrade to Version 4.2.1 and the problem still occurred. I tried the above solution and unfortunately had no luck.
I did however get Apache running again by selection all options for the directory directive as shown in the image below:
This issue occurred completely randomly, one day everything working fine then the next... Apache says no. I believe the issue is that like web browsers use a Cache and separately also hold open processes, i think sometimes when MAMP or MAMP Pro is not closed properly then it can screw up Apache because it is not stopped correctly.
I hope this answer helps any persons experiencing this issue!
In case above answers didn't fix it, you can check that Document Root isn't set on some non-existing directory.
Go to MAMP Settings > Web-Server > Document Root
I found a Solution:
JUST:
in /Applications/Mamp/Library/bin, find the file envvars and rename it to _envvars.
this issue comes to me today …
after trying several solutions, i found this dialog message may appear if MAMP no longer finds a certificate used by a securized localhost.
So be careful to keep them in a place you won't move or delete.
hope it helps