Apache runs after reboot, but does not work - apache

I am running an Apache on Ubuntu which works pretty fine. However, if I issue 'shutdown -r now' and wait until the server has been booted successfully, the website won't show up in the browser.
Then, if I issue: service apache2 start, it'll show:
[Thu Jun 14 11:08:38 2012] [error] (EAI 2)Name or service not known: Could not resolve host name *.443 -- ignoring!
[Thu Jun 14 11:08:38 2012] [warn] The ScriptAlias directive in /etc/apache2/sites-enabled/default2 at line 18 will probably never match because it overlaps an earlier ScriptAlias.
[Thu Jun 14 11:08:38 2012] [warn] The Alias directive in /etc/apache2/sites-enabled/default2 at line 34 will probably never match because it overlaps an earlier Alias.
[Thu Jun 14 11:08:38 2012] [warn] _default_ VirtualHost overlap on port 443, the first has precedence
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
Action 'start' failed.
The Apache error log may have more information.
* Starting web server apache2 FAIL
However, when I issue service apache2 stop, it'll show:
[Thu Jun 14 11:09:34 2012] [error] (EAI 2)Name or service not known: Could not resolve host name *.443 -- ignoring!
[Thu Jun 14 11:09:34 2012] [warn] The ScriptAlias directive in /etc/apache2/sites-enabled/default2 at line 18 will probably never match because it overlaps an earlier ScriptAlias.
[Thu Jun 14 11:09:34 2012] [warn] The Alias directive in /etc/apache2/sites-enabled/default2 at line 34 will probably never match because it overlaps an earlier Alias.
[Thu Jun 14 11:09:34 2012] [warn] _default_ VirtualHost overlap on port 443, the first has precedence
* Stopping web server apache2 OK
However, afterwards netstat -tulpn| grep :80 still shows:
tcp6 0 0 :::80 :::* LISTEN 23561/apache2
Anyways, when I just kill the process shown above, e.g., kill -9 23561, I can successfully startup apache2 with service apache2 start and see my website again in the browser. So, for me it looks like, there is another apache2 running that uses a completely different configuration. Btw, I already assured that I have only one apache2 installation.
Can you help me out with this? Many thanks in advance!!! :-)

Related

MAMP: Apache Server is shut down automatically in Windows 10

OS: Windows 10
MAMP: 4.1.1
After installation, every time I run the program, Apache light goes green for a second and then turns off automatically. MySQL runs fine though.
The log file located at C:\MAMP\logs\apache_error.log contains these lines.
[Fri Jan 17 18:03:42 2020] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Fri Jan 17 18:03:43 2020] [warn] pid file C:/MAMP/bin/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Fri Jan 17 18:03:43 2020] [notice] Digest: generating secret for digest authentication ...
[Fri Jan 17 18:03:43 2020] [notice] Digest: done
I find a lot of people online encountered the same situation as mine. But I cannot find out the solution. So I come here to find the potential solution.
P.S. I don't have the common Port 80 confliction problem. So I'm sure my problem is not related to it.
Navigate to C:\MAMP\conf\apache\extra.
Edit the httpd-ssl.conf and comment the following line:
...
SSLSessionCache shmcb:/some/example/path/ssl_scache(512000)
...
To:
...
# SSLSessionCache shmcb:/some/example/path/ssl_scache(512000)
...
Also, check out https://cwiki.apache.org/confluence/display/HTTPD/SSLSessionCache for more info. Hope this helps.

Localhost is not working

I spend a day this issue, and I can't fix it.
Everytime I try to access to my localhost or by typing 127.0.0.1, the browser that I'm using is returning an error like : "Firefox can not find the server address at www.localhost.com."(i'm french, I translated the issue).
The same issue occures in Google Chrome and with 127.0.0.1. I tried with XAMPP and WAMP, still nothing. My Apache httpd.conf seems good, I tried to change the port (8080, 81, 8800). It still not working. My Skype is not open nether VMware Workstation. There is no program blocking the access to port 80 or 443.
I've made a ping test with the localhost and everthing is ok, but I can't access the index page of WAMP or XAMP.
The weird thing is that I can access to localhost/phpmyadmin and other pages like that.
I think my problem is in the hosts file of Windows, but it seems ok to me :
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 localhost
::1 localhost
Why am I thinking of the hosts file? Because my vhost in XAMPP and in WAMP are not working. Maybe I'm wrong, but this problem is driving me crazy!
Thanks for the help
If you have defined Virtual Hosts, and thats a very good idea, then you need to define the vhosts name in the HOSTS file.
For example, the hosts file:
127.0.0.1 localhost
::1 localhost
127.0.0.1 vhost1.dev
::1 vhost1.dev
127.0.0.1 vhost2.dev
::1 vhost2.dev
Otherwise windows has no way of knowing where to look for them.
Another possibility for localhost not working is a corrupted HOSTS file. Try deleting it and recreating it with an editor that is not notepad.
Also when you change the HOSTS file you need to restart the dmscache service 'DNS Client' by either rebooting or better still run a command window using "Run as Administrator" and do this
net stop dnscache
net start dnscache
that activates the new entries in your hosts file.
The weird thing is that I can access to localhost/phpmyadmin and other
pages like that.
Sounds to me like your hosts file is fine. There is something preventing Apache from starting up and binding to your port.
I'm not too familiar with Windows, but from the documentation:
Any errors during Apache startup are logged into the Windows event log
when running on Windows NT. This mechanism acts as a backup for those
situations where Apache is not yet prepared to use the error.log file.
You can review the Windows Application Event Log by using the Event
Viewer, e.g. Start - Settings - Control Panel - Administrative Tools -
Event Viewer.
Take a look to see what is preventing Apache from booting.
I don't now if it will help you, this is what I get in my log when I restart Apache
[Thu Jun 05 15:41:13.480163 2014] [mpm_winnt:notice] [pid 9984:tid 392] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Thu Jun 05 15:41:15.481278 2014] [mpm_winnt:notice] [pid 6728:tid 268] AH00364: Child: All worker threads have exited.
[Thu Jun 05 15:41:15.504279 2014] [mpm_winnt:notice] [pid 9984:tid 392] AH00430: Parent: Child process 6728 exited successfully.
[Thu Jun 05 15:41:20.536567 2014] [ssl:warn] [pid 9648:tid 392] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jun 05 15:41:20.735578 2014] [ssl:warn] [pid 9648:tid 392] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jun 05 15:41:20.757580 2014] [mpm_winnt:notice] [pid 9648:tid 392] AH00455: Apache/2.4.9 (Win32) OpenSSL/1.0.1g PHP/5.5.11 configured -- resuming normal operations
[Thu Jun 05 15:41:20.757580 2014] [mpm_winnt:notice] [pid 9648:tid 392] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:13:13
[Thu Jun 05 15:41:20.757580 2014] [core:notice] [pid 9648:tid 392] AH00094: Command line: 'C:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Thu Jun 05 15:41:20.758580 2014] [mpm_winnt:notice] [pid 9648:tid 392] AH00418: Parent: Created child process 3700
[Thu Jun 05 15:41:21.108600 2014] [ssl:warn] [pid 3700:tid 268] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jun 05 15:41:21.274609 2014] [ssl:warn] [pid 3700:tid 268] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Jun 05 15:41:21.296610 2014] [mpm_winnt:notice] [pid 3700:tid 268] AH00354: Child: Starting 150 worker threads.
Yesterday, I managed to get rid of the [ssl:warn] [pid 3700:tid 268] AH01909, but that wasn't the problem.
In my windows event viewer, there is no change, nothing was reported at same time of the restart.
Note : I've uninstall my current antivirus (I now it's not recommanded) and my Windows firewall does't seesm to block the connection to localhost.
Ok I've done what RiggsFolly told me. I delete my hosts file and create a new one. I restart my dmscache service. After, that I decide to create a virtual host for my localhost. In my httpd.conf, I checked if the Virtual hosts were inlucde
Include conf/extra/httpd-vhosts.conf
and in my httpd-vhosts.conf I wrote :
<Directory "/xampp/htdocs">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster#das.com
DocumentRoot /xampp/htdocs/
<Directory "/xampp/htdocs/">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Now everything seems to work, I can create other virtual hosts with custom name in my hosts file.

mod_jk not changes IP of hostname when occurs changing of IP on DNS

In apache, the module mod_jk not changes IP of hostname when occurs changing of IP on DNS.
Version of apache:
Server version: Apache/2.2.15 (Unix)
Server built: Aug 2 2013 08:02:15
Version mod_jk: 1.2.37
Example:
workers.properties
worker.portalconsultoras_prd.type=ajp13
worker.portalconsultoras_prd.host=hostexample.com.br
worker.portalconsultoras_prd.port=8009
This configuration works fine.
But, when occurs change ip in the host name in DNS, the module md_jk starts fail to connect. Follow below the log of mod_jk:
[Wed Sep 18 12:00:33 2013] [5315:140659824723936] [info] jk_open_socket::jk_connect.c (627): connect to 107.xx.xx.220:8009 failed (errno=115)
[Wed Sep 18 12:00:33 2013] [5315:140659824723936] [info] ajp_connect_to_endpoint::jk_ajp_common.c (995): Failed opening socket to (107.xx.xxx.220:8009) (errno=115)
[Wed Sep 18 12:00:33 2013] [5315:140659824723936] [error] ajp_send_request::jk_ajp_common.c (1630): (portalconsultoras_prd) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=115)
I would like a configuration of apache that avoid this problem.
Looking for the solutions in google, have turn on the "HostnameLookups", but is inefficient.
Thanks!

Apache WSASocket failed to open the inherited socket. (LMHOSTS disabled)

[Thu Aug 09 11:20:30 2012] [notice] Child 4656: Child process is running
[Thu Aug 09 11:20:30 2012] [crit] (OS 10022)An invalid argument was supplied. : Child 4656: setup_inherited_listeners(), WSASocket failed to open the inherited socket.
[Thu Aug 09 11:20:30 2012] [crit] Parent: child process exited with status 3 -- Aborting.
I have started getting this error unexpectedly. I dont believe I changed any conf files.
Are there are any temporary files I can reset in the apache installation? I have moved everything from /xampp/tmp
I have checked to see if localhost:80 is in use, I dont think this is the case.
I have reset netsh as specified here: https://issues.apache.org/bugzilla/show_bug.cgi?id=31765
Please recommend steps to reset apache as I believe it is possible this is an issue caused by a orphaned PID or something of that nature as nothing has changed and I do unexpected shutdowns of my computer.
This is on Windows XP, apache httpd.exe version is 2.2.11.0
Port 443 was in use. Then magically ceased being in use. Then I guess perhaps netsh reset caused LMHOSTS to be enabled because I ended up with Local Connection being renamed to Local Connection 2 with LMHOSTS enabled. This is called magic.
Panda Media Booster was using 443.

apache won't start

Ok, so this has me so stumped that I don't see myself being able to solve the problem on my own.
I am running apache on my laptop under linux, so that when I'm away from my desktop I can still work with php and mySql. Everything works great. There is nothing wrong with the syntax of the httpd.conf; apachectl configtest returns OK. However, there is one cafe that I go to where apache will not start. I'll go down the street to the next ap and apache will start without issue, but at this one cafe apache won't start. Any help will be appreciated.
The log entry that I believe to be relevant is
[Wed Nov 16 14:03:11 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "laptop"
[Wed Nov 16 14:33:36 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "laptop"
[Wed Nov 16 14:42:48 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "laptop"
[Wed Nov 16 14:45:27 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "laptop"
[Wed Nov 16 14:52:54 2011] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "laptop"
If output of a command hostname is
# hostname
laptop
Giving this error in your logs:
(EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "laptop"
Then you should put in your /etc/hosts file sth like this :
127.0.0.1 laptop.homenetwork laptop localhost
::1 laptop.homenetwork laptop localhost
It also helps some people to put
ServerName localhost
in /etc/apache2/httpd.conf file
wait will apache not start or is the port blocked in this cafe? that would make sense to me and not that apache won't start. also, what happens if apache is running prior to going to this cafe? if you're still having issues, and i don't mean to sound cheeky here, but don't go to that particular cafe :)