Solved Can't start Apache22

Hello,
I just installed the Apache-webserver on FreeBSD 7.1, it's version 2.2.11_4.
I added
Code:
apache22_enable="YES"
to rc.conf
and uncommented
Code:
Severname 127.0.0.1:80
in httpd.conf.

I tried to start Apache:
Code:
/usr/local/etc/rc.d/apache22 start
Performing sanity check on apache22 configuration:
Syntax OK
Starting apache22

A few seconds later I get my command-line back..
but apperantly Apache isn't running on any port, as it isn't listed in the output of
Code:
sockstat -4
or
Code:
ps

And when I start the apache22 script again, it's the same procedure as described above...I don't get a warning that it's already running or something like that.

Did I forget anything trivial?
Could you tell me why my webserver isn't running?

Thanks,
Nokobon
 
DutchDaemon said:
Look in /var/log/httpd-error.log

There is an error:
Code:
[Sun Jun 07 01:03:52 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sun Jun 07 01:03:55 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of "***"
Configuration Failed

By the way:
The router between the local network and ISP blocks every traffic on port 80 from the outside...
May that cause any problems even though I want to test the webserver only in the LAN first?
 
DutchDaemon said:
Do you have 'Listen' defined in httpd.conf?
Yes:
Code:
Listen 80

Except for the ServerName and ServerAdmin entries it's the default configuration of httpd.conf. I dind't change anything else....
 
Nothing shown in:

[cmd=]ps ax | grep httpd[/cmd]
or
[cmd=]netstat -an | grep \\.80[/cmd]
or
[cmd=]sockstat -l4 | grep :80[/cmd]?
 
No...nothing, Apache isn't running.

By the way:
I use TCP-Wrapper...is this rule correct:
Code:
httpd : all : allow
?
 
That's fine.

Try this. Don't use 127.0.0.1, but the name of your server and its real IP address (something like 192.168.x.x or 10.0.x.x, whatever you have).

Make sure that that IP address is in /etc/hosts, and that it has a fully-qualified domain name (you can make one up, like box.domain.local).

Then use as ServerName box.domain.local:80. Now start Aapche.
 
Okay I tried both...the local Ip-address and the hostname as SeverName.
Doesn't change anything...still not startin and the same error in the log.

I forgot to mention that I use DynDNS with ddclient.
May that inhibit Apache?
I disabled ddclient in rc.conf to try apache without it.
But after a reboot ddclient is still listed under ps.
How do I really stop it?
 
Remove the following from /etc/rc.conf:
Code:
ddclient_enable="YES"
And stop existing client:
Code:
/usr/local/etc/rc.d/ddclient forcestop

Do you have host entry in /etc/hosts file for your server IP? If no dns is working httpd can use host entry from this file. A sample entry:
Code:
127.0.0.1	vivek-desktop	localhost.localdomain	localhost
With above 127.0.0.1 should be work with httpd.
 
Thank you very much for your helpful advises!

I disabled ddclient, changes my hostname to localhost.localdomain.local with sysinstall and added this to /etc/hosts:
Code:
127.0.0.1   localhost  localhost.localdomain.local

After a reboot Apache started and now it works!
Thanks!

Now I will try to get ddclient working again because of my dynamic IP.

My DynDNS domain looks like myname.homeunix.net.
Am I right, that I just have to change the /etc/hosts entry to:
Code:
127.0.0.1 localhost localhost.myname.homeunix.net
?
Or does it have to look differently?
 
Don't use localhost as a hostname. Pick something, anything you like but not localhost. If you don't have enough imagination do what I do, pick names from your favorite book.

NB Also don't use .local as a TLD. It's used by Avahi/zeroconf.
 
Yeah, sure. I will change the hostname (the names-from-books-idea is fine^^), and the .local-domain was for testing purpose.
Now I change it to my DynDNS-Domain.
I just wanted to know if this /etc/hosts-entry is correct and if this is all I need to do.
 
Hi @DutchDeamon I have the same issue reporting by Nokobon. I have recently installed Apache24 on my FreeBSD 10. It's working fine. I configured my httpd.conf in order to include a virtualhost for displaying the graph of queries of my DNS server. After that my Apache server did'nt respond. I performed the apachectl configtest and the output shows me that the Syntax is OK.
Here is the following output of these commands:

tail -f /var/log/httpd-error.log
Code:
[Sat Jan 02 14:36:18.283232 2016] [core:notice] [pid 1070] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'
[Sat Jan 02 16:34:50.149952 2016] [mpm_prefork:notice] [pid 1070] AH00169: caught SIGTERM, shutting down
[Sat Jan 02 16:34:50.274833 2016] [mpm_prefork:notice] [pid 2374] AH00163: Apache/2.4.18 (FreeBSD) configured -- resuming normal operations
[Sat Jan 02 16:34:50.275274 2016] [core:notice] [pid 2374] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'
[Sun Jan 03 17:06:22.275987 2016] [mpm_prefork:notice] [pid 2374] AH00169: caught SIGTERM, shutting down

ps ax | grep httpd
Code:
1091 v0  R+  1342:43.80 /usr/local/sbin/httpd -DNOHTTPACCEPT
1693  0  S+  0:00.00 grep httpd

sockstat -l4 | grep :80
Code:
root  httpd  1091  4  tcp4  *:80  *:*

netstat -an | grep \\.80
Code:
tcp4  422   0     x.x.x.12.80  185.130.5.224.60000   CLOSED
tcp4  422   0     x.x.x.12.80  185.130.5.224.60000   CLOSED
tcp4  422   0     x.x.x.12.80  185.130.5.224.60000   CLOSED
tcp4  52    0     x.x.x.12.80  46.174.191.28.50000   CLOSED
tcp4  29    0     x.x.x.12.80  212.129.49.46.55398   CLOSED
tcp4  422   0     x.x.x.12.80  185.130.5.224.60000   CLOSED
tcp4  97    0     x.x.x.12.80  141.212.122.112.15194 CLOSED
tcp4  422   0     x.x.x.12.80  185.130.5.224.60000   CLOSED
tcp4  422   0     x.x.x.12.80  185.130.5.224.60000   CLOSED
tcp4  422   0     x.x.x.12.80  185.130.5.224.60000   CLOSED
tcp4  422   0     x.x.x.12.80  185.130.5.224.60000   CLOSED
tcp4  422   0     x.x.x.12.80  185.130.5.224.60000   CLOSED
tcp4  422   0     x.x.x.12.80  185.130.5.224.60000   CLOSED
tcp4  0     0            *.80  *.*                   LISTEN
tcp6  0  0 *.80  *.*  LISTEN

Any help will be welcome.

Regards
 
Last edited by a moderator:
Your output shows Apache is up and running and listening on port 80. So what's the issue?
 
I used Mozilla Firefox and I typed the IP address of my server in the URL bar and it's happened nothing. I also checked the different logs of my Apache server and I observed that there are same results mentioned in my previous post.
 
Last edited by a moderator:
Thanks wblock@ for your support and replying me.
The netstat -an | grep \\.80, sockstat -l4 | grep :80 commands show me nothing output. My /usr/local/etc/apache24/httpd.conf syntax is correct accordingly to this output.
Code:
#apachectl configtest
Performing sanity check on apache24 configuration:
Syntax OK
But I can't still to display a web page when I type the IP address of my Apache server. I really want to know what's going on behind the scenes.
Any help will be welcome. Thanks to reply

Regards.
 
Last edited by a moderator:
"Nothing happened" is still missing some details. Firefox will usually time out and show an error. This can help to identify the problem.

Is Firefox on the same computer as the web server? Is the IP address a public or private address? Can the server be pinged?
 
T hanks wblock@ for your quick reply.
Firefox is not installed on the web server and the web server's IP address is a public address. Actually I can ping the server without problems.

Regards
 
Still no information on what exactly happens in Firefox. The thinking here is that a firewall is involved. It might work from outside the network due to firewall redirection, and not work inside the network due to NAT.
 
Sorry if I missed something and this has already been mentioned, but in this case I would check that document root and port is defined in /etc/apache2/sites-available/default and that there isn't a DNS problem. Check that http://yourip (not domain name) works.

Edit to add. Since you didn't appear familiar with how to check that a service is running, you might want to familiarize yourself with this:
Code:
#service apache2 status
#service apache2 start
#service apache2 stop
(It works with a lot of other programs too.)
 
Thanks everybody to pay attention to my problem. In fact in my /usr/local/etc/apache22/httpd.conf I've included some directives in the SSL section, then after removed these new directives, my apache server responds well. Thanks for your support
 
Back
Top