# [SOLVED] unable to start apache server

## abdus

hi guys how are you doing, i am trying to setup LAMP on my machine, it is under hardened/selinux profile. 

i installed php, mariadb successfully apache is installed successfully as well, however when i try to execute

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

 as root i keep getting errors about missing modules so i added the missing modules. however now when i want to run

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

after making sure all the modules are installed, i get this error

```
apache2: Syntax error on line 153 of /etc/apache2/httpd.conf: Cannot load modules/mod_proxy_http2.so into server: /usr/lib64/apache2/modules/mod_proxy_http2.so: undefined symbol: ap_proxy_location_reverse_map

apache2                   | * ERROR: apache2 failed to start

```

for checking if it works by opening localhost on the host machine, it does not work, i cannot open that page whether on firefox or chromium browsers

please help me guys, thank you

----------

## abdus

i found this https://forums.gentoo.org/viewtopic-t-949708-start-0.html

which helped with the modules

----------

## abdus

my case now is similar to this https://forums.gentoo.org/viewtopic-t-948826-start-0.html i followed the instructions but still not working

----------

## abdus

the verbose output of the error is 

```

apache2                   |apache2                   | * Executing: /lib/rc/sh/openrc-run.sh /lib/rc/sh/openrc-run.sh /etc/init.d/apache2 start

apache2                   | * Starting apache2 ...

apache2                   | * start-stop-daemon: fopen `/var/run/apache2.pid': No such file or directory

apache2                   | * Detaching to start `/usr/sbin/apache2' ...

apache2                   | *   start-stop-daemon: failed to start `/usr/sbin/apache2'                                                                    [ !! ]

apache2                   | * ERROR: apache2 failed to start

```

----------

## Hu

What is the output of namei -l /run /var/run?  You should have:

```
$ namei -l /run /var/run

f: /run

drwxr-xr-x root root /

drwxr-xr-x root root run

f: /var/run

drwxr-xr-x root root /

drwxr-xr-x root root var

lrwxrwxrwx root root run -> /run

drwxr-xr-x root root   /

drwxr-xr-x root root   run
```

----------

## abdus

the output is just like yours

----------

## Hu

That suggests the diagnostic about the pidfile is not relevant.  What is written to the Apache logs when it fails to start?

----------

## abdus

where to find the log??

----------

## bbgermany

Maybe this helps:

https://ocroquette.wordpress.com/2018/04/30/apache-undefined-symbol-ap_proxy_location_reverse_map/

Greetings Stefan

----------

## abdus

thank you for your help but for the error of "syntax error" i just followed the thread above and i only had to comment the lines that start those modules. now i have the error

```
apache2                   |apache2                   | * Executing: /lib/rc/sh/openrc-run.sh /lib/rc/sh/openrc-run.sh /etc/init.d/apache2 start

apache2                   | * Starting apache2 ...

apache2                   | * start-stop-daemon: fopen `/var/run/apache2.pid': No such file or directory

apache2                   | * Detaching to start `/usr/sbin/apache2' ...

apache2                   | *   start-stop-daemon: failed to start `/usr/sbin/apache2'

```

----------

## bbgermany

then as Hu already wrote; check the logfiles.

greetings Stefan

----------

## abdus

the log file is supposed to be "access.log" when executing the command locate access.log, i get no output.

locate command is supposed to work well with me, i made sure it does

----------

## hdcg

Hi abdus,

assuming you did not change the default log configuration.

The log file of interest will be: 

```
/var/log/apache2/error_log
```

as Apache is not able to start. The access log

```
/var/log/apache2/access_log
```

will only be written after Apache is running and accepting requests.

Best Regards,

Holger

----------

## abdus

thank you very much for the info

the output file is here https://dpaste.com/4NHESALRH

it says the module mod_request needs to be loaded

----------

## abdus

where can i find that module? it isn't listed in APACHE2_MODULES when i want to reemerge apache package

----------

## Hu

Some modules may be available by default, and not subject to a Portage configuration flag.  Was mod_request.so built for you?  It is for me:

```
/usr/lib64/apache2/modules/mod_request.so
```

However, even if it is installed, it may not be enabled in your Apache configuration.  You could also choose to disable use of mod_auth_form so that you do not need mod_request.

----------

## bbgermany

 *Hu wrote:*   

> Some modules may be available by default, and not subject to a Portage configuration flag.  Was mod_request.so built for you?  It is for me:
> 
> ```
> /usr/lib64/apache2/modules/mod_request.so
> ```
> ...

 

copy that, and usually "a2enmod" and "a2dismod" should help you in this case as well.

greetings Stefan

----------

## grknight

 *bbgermany wrote:*   

>  *Hu wrote:*   Some modules may be available by default, and not subject to a Portage configuration flag.  Was mod_request.so built for you?  It is for me:
> 
> ```
> /usr/lib64/apache2/modules/mod_request.so
> ```
> ...

 

Those 2 commands are a Debian specific addition.  Normal configuration file editing is required on Gentoo.

----------

## bbgermany

 *grknight wrote:*   

> Those 2 commands are a Debian specific addition.  Normal configuration file editing is required on Gentoo.

 

OMG, how could i miss this. Im working with debian servers for too long already. Im sorry  :Sad: 

greetings Stefan

----------

## abdus

i put 

```
LoadModule request_module modules/mod_request.so
```

 to /etc/apache2/httpd.conf

apache server did not want to start, i disabled mod_auth_form still not wanting to start

the new lines in error log are

```
[Thu Nov 17 07:09:39.752305 2022] [:notice] [pid 20869:tid 139940753247680] ModSecurity for Apache/2.9.5 (http://www.modsecurity.org/) configured.

[Thu Nov 17 07:09:39.752382 2022] [:notice] [pid 20869:tid 139940753247680] ModSecurity: APR compiled version="1.7.0"; loaded version="1.7.0"

[Thu Nov 17 07:09:39.752390 2022] [:notice] [pid 20869:tid 139940753247680] ModSecurity: PCRE compiled version="8.45 "; loaded version="8.45 2021-06-15"

[Thu Nov 17 07:09:39.752396 2022] [:notice] [pid 20869:tid 139940753247680] ModSecurity: LIBXML compiled version="2.10.2"

[Thu Nov 17 07:09:39.752400 2022] [:notice] [pid 20869:tid 139940753247680] ModSecurity: Status engine is currently disabled, enable it by set SecStatusEngine to On.

[Thu Nov 17 07:09:39.823091 2022] [lbmethod_bybusyness:emerg] [pid 20870:tid 139940753247680] AH10151: mod_proxy must be loaded for mod_lbmethod_bybusyness

[Thu Nov 17 07:09:39.823124 2022] [:emerg] [pid 20870:tid 139940753247680] AH00020: Configuration Failed, exiting

```

 i had not to use wgetpaste, it doesn't want to work, i'm sorry for that.

it says i need to load mod_proxy which is already uncommented in /etc/apache2/httpd.conf

----------

## bbgermany

Hi,

did you see this line:

```

[Thu Nov 17 07:09:39.823091 2022] [lbmethod_bybusyness:emerg] [pid 20870:tid 139940753247680] AH10151: mod_proxy must be loaded for mod_lbmethod_bybusyness

```

Enable mod_proxy or disable all the modules that are mentioned if you do not enable mod_proxy and retry.

greetings Stefan

----------

## hdcg

Hi abdus,

please check the config file in detail.

Per default mod_proxy is guarded by a define 

```
<IfDefine PROXY>

LoadModule proxy_module modules/mod_proxy.so

</IfDefine>
```

To enable mod_proxy with this config, add -D PROXY to /etc/conf.d/apache2. Like

```
APACHE2_OPTS="... -D PROXY ..."
```

Do not remove the other already defined options.

Furthermore if you modify httpd.conf directly, make sure the module order matches. I am not quite sure, but your error may also occur if mod_proxy is loaded after the depending module.

Best Regards,

Holger

----------

## abdus

i enabled the mod_proxy the way you said, it caused me to add some other modules since they are needed there was an erro saying that those modules are not found so i added them to APACHE2_MODULES , and it worked.

thank you very much for your help god bless you and bless this comunity.

i appreciate your help. see you

----------

