# apache2 won't start

## andyfaeglasgow

Hi,

I'm trying to get apache running just for testing.  When I tried just starting the init script I get the following.

```

# /etc/init.d/apache2 start

 * Starting apache2...

apache2: Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

(2)No such file or directory: apache2: could not open error log file /usr/lib/apache2/logs/error_log.

Unable to open logs                                                       [ !! ]

```

Does this mean that there's a prob with the way my hostname/dnsdomainname is set?

Also, checking the docs at apache, I saw them refer to httpd.conf.  Is this the same as apache2.conf.  Why do we use a different location for the configuration file (if this the case)?

Is there a quick guide for getting apache up and running?  I just want to see it serve a page,  then I'll dig into the details later

Happy New Year,

Andy

----------

## adaptr

Edit /etc/apache2/conf/apache2.conf and make sure that:

- the ServerName is set to something sensible, i.e at least either a resolvable FDQN or an existing IP address (one assigned to an actual NIC).

- the ServerRoot is set to the correct location, for Gentoo this is /usr/lib/apache2

If these are set then it should at least start.

And yes, if you did set a hostname for the ServerName and it fails then you did not configure your hostname/domainname correctly.

----------

## Mayhem

Look into this thread please

https://forums.gentoo.org/viewtopic.php?t=104806

good luck

----------

## andyfaeglasgow

 *Quote:*   

> 
> 
> Make sure...
> 
> the ServerName is set to something sensible
> ...

 

But the comments in that file say you shouldn't change that "unless you're a guru" WTF?!   :Smile: 

Andy

[/quote]

----------

## yank

i'm having the same problems as this guy, plz help, tried everything in that other thread

----------

## mntlcase

cd /usr/lib/apache2

mkdir logs

fixed it for me....

I also had to add my hostname to /etc/hosts because apache kept erroring out with an unable to resolve error, even when ServerName was set to the IP address of the NIC.

----------

## Jiraiya

 *mntlcase wrote:*   

> 
> 
> I also had to add my hostname to /etc/hosts because apache kept erroring out with an unable to resolve error, even when ServerName was set to the IP address of the NIC.

 

probably because of a var "UseCannonical" was set to "On". Check in your configs.   :Wink: 

----------

## glowinthedark

The problem to the NameServer error in Apache2 could also be in the /etc/apache2/conf/apache2.conf file.  

LoadModule  mod_unique_id is uncommented and causes problems...try commenting out this line and start apache /etc/init.d/apache2 start and problem should disappear

----------

## vvenka1

The apache is failing because it is not finding the log directory. the log directory, /usr/lib/apacle2/logs is a simlink to /var/log/apache2/, but the current ebuild didn't create (as of jan 13, 2005) the simlinked directory properly. 

```
# mkdir -p /var/log/apache2
```

 as root should fix the problem. 

the trivial hostname issue can be fixed later.

----------

## mrawde

I am getting the same problem.  I have the log dir made and everything.  When I run: 

```
/etc/init.d/apache2 start
```

 I get:

```
 * Starting apache2...                                                    [ !! ]
```

Is there anyway to make apache2 show more debug info?  Is there anyway to make sure httpd is running?

----------

## adaptr

 *mrawde wrote:*   

> Is there anyway to make apache2 show more debug info?

 

/var/log/apache2/error_log has any and all startup messages.

 *mrawde wrote:*   

>  Is there anyway to make sure httpd is running?

 

```
ps fax |grep apache
```

----------

## k3rnel

I am getting the same problem as mrawde is, I looked through the error logs and found the following: 

```
[Tue Jan 18 21:28:19 2005] [crit] (38)Function not implemented: mod_rewrite: could not create rewrite_log_lock

Configuration Failed

```

Anyone have any ideas?

----------

## adaptr

Either you have not enabled the mod_rewrite module - which is weird, since it is enabled by default - or something has gone wrong with your apache emerge.

Any errors or messages during ?

----------

## k3rnel

I had a problem during my first attempt at installing Apache, details here: 

https://forums.gentoo.org/viewtopic.php?t=281562&highlight=

I ended up emerging libtools by itself, and that seemed to fix it. Now for whatever reason I am getting this problem. Also, there is no error_log in /var/logs/apache2/, it is located at /usr/lib/apache2/logs instead? How can I check if the mod_rewrite module is enabled or not, would this be in apache.conf?

----------

## adaptr

Open up /etc/apache2/conf/apache2.conf and search for the mod_rewrite LoadModule line; if it is not commented out then it should be loaded.

Otherwise - to really check it - fire up apache2 on a higher debug setting and the modules loaded should be in the startup log.

If the log dir symlinks are also missing methinks more than trivial things have gone wrong during your emerge...

----------

## k3rnel

 *adaptr wrote:*   

> If the log dir symlinks are also missing methinks more than trivial things have gone wrong during your emerge...

 

I agree with you, I think the install somehow got botched. I did an emerge sync and it picked up a new ebuild, so there may have been a bug. Im reinstalling Apache now, Ill post back later with my results.

----------

## k3rnel

Still no go on this, I am still being met with the same error.   :Sad: 

----------

## oiper

 :Evil or Very Mad:   I have a damnable solution!

```
echo ">net-www/apache-1.3.33" >> /etc/portage/package.mask
```

 :Evil or Very Mad:  I just don't have time to fight with apache2 all flippin' day!   :Evil or Very Mad: 

I would like to know what the flippin' deal is though.   :Rolling Eyes:   :Question: 

Sorry for all the "flippin's", I saw Napoleon Dynomite recently.

"Peace out"

----------

## thegerb

 *Quote:*   

> The apache is failing because it is not finding the log directory. the log directory, /usr/lib/apacle2/logs is a simlink to /var/log/apache2/, but the current ebuild didn't create (as of jan 13, 2005) the simlinked directory properly.
> 
> Code:
> 
> # mkdir -p /var/log/apache2
> ...

 

creating the directory by

# mkdir -p /var/log/apache2

fixed the problem of apache not finding the error logs for me

and the domain name part is easily solved by:

#nano /etc/apache2/conf/apache2.conf

then uncommenting the line beginning ServerName and adding your IP address or domain name.

ServerName <your ip address>

hth

----------

## CBJ

Hi,

```
rm /usr/lib/apache2/logs

mkdir /usr/lib/apache2/logs 
```

Does the trick...

----------

