How to debug mod_ldap in Apache - apache

I am trying to debug an apache to ldap connection. The Apache server just reply with an Error 500 in the access.log file. I do not have any error in the error.log file.
I have seen that the LDAPLibraryDebug Directive is only available in Apache 2.4 and I am using Apache 2.2. Any ideas on how add more debug messages in the error log?

You can add "LDAPLibraryDebug" to a 2.2 server with this debug module:
https://github.com/covener/apache-modules/tree/master/mod_ldap_debug

To debug mod_ldap (and mod_authz_ldap) you need to have both services (Apache and LDAP) in debug mode.
For Apache use configuration parameter in sequence :
LogLevel debug
More info available on follow URL https://www.loggly.com/ultimate-guide/apache-logging-basics/
For LDAP service (if you use OpenLdap) stop standard service and start OpenLdap in foreground debug mode with (example):
slapd -d 128
More info available on follow URL https://www.openldap.org/doc/admin24/runningslapd.html

Related

Apache configuration: how to get quick feedback?

When writing configuration files for Apache web server I would like to have a quick feedback loop.
I, for example have a script that doesn't seem to work. It is either not picked up, or the variables I use are not set, or maybe overriding is not allowed. How to debug this?
I expected to at least print some debug log statements like REQUEST_URI: %{REQUEST_URI}. Can't find such a thing.
apachectl is a front end to the Apache HyperText Transfer Protocol (HTTP) server. It is designed to help the administrator control the functioning of the Apache httpd daemon.
Here is a link to the documentation.
Different platform might use different binary names such as apache, apache2 or apache2ctl. To test the configuration - just run:
apachectl configtest
# or, depending on your OS
httpd -t
EDIT
If you are trying to debug your virtual host configuration, you may find the Apache -S command line switch useful. That is, type the following command:
httpd -S
This command will dump out a description of how Apache parsed the configuration file

reverse proxy apache to localhost server

I've got a web app running on localhost:3000. I also have an apache server. I would like to reverse proxy the apache server so that requests to /mywebapp get forwarded to the server running on localhost:3000.
I currently have the following config at the bottom of my httpd.conf file, but I'm getting a server error when I try to access it:
ProxyPass /mywebapp http://localhost:3000
ProxyPassReverse /mywebapp http://localhost:3000
Edit - further details:
I'm running a jetty server with java -jar myapp.jar. I'd like to forward requests to an apache server listening on :80 to the jetty server.
I've got mod_proxy_http.so and mod_proxy.so enabled.
I can tell the server is running on localhost - it responds to curl with the appropriate http response. So I'm pretty sure the issue is with my apache setup, but I can't think what the problem would be.
Apache conf file in conf.d for reference: http://pastebin.com/vhXwjbQe
And I've got this in my httpd.conf:
Include conf.d/*.conf
It's hard to give a generic answer because every situation is different so here are some debugging questions to ask yourself:
if the protocol and port correct on the internal service, http and 3000.
Is the service actually listening for connections from localhost? is it running in a docker container etc that would require it to be listening on a different interface? You can check for this by looking at the output from mywebapp's logs and see if the request are making it through the proxy.
Do the paths on the internal service include the prefix that is being passed to Apache or does apache need to strip these off. if for instance mywebapp expects the path "/foo/bar" and apache's reverse proxy is sending it with the context path included "/mywebapp/foo/bar" then it will not match any path in mywebapp.

Not able to start Apache HTTP Server on Cent OS 6.4

While starting Apache tomcat, am getting error Starting httpd: Syntax error on line 3 of /etc/httpd/conf/httpd.conf: Invalid command 'AddHandler', perhaps misspelled or defined by a module not included in the server configuration I am using Cent OS 6.4 . I used the command service httpd start for starting the server.
You are trying to use Apache HTTP server configuration file with Tomcat.
Tomcat has it's own config files in TOMCAT-HOME/conf/ directory.
If you're actually talking about Apache HTTP, not Tomcat, you may get this error if there's no mime_module. Run httpd -M command to check if mime_module present or not.

I am trying to forward my apache logs to rsyslog then to splunk

I am trying to make all of my apache and drush logs forward to my Splunk server via rsyslog.
First, in my /etc/httpd/conf/httpd.conf file I change the entry:
ErrorLog var/log/httpd/error_log
to:
ErrorLog syslog:local1
as described at: http://wiki.rsyslog.com/index.php/Working_Apache_and_Rsyslog_configuration
Then in /etc/rsyslog.conf, I add:
# Save apache messages to apache.log
local1.* /var/log/apache.log
to have the logs prefixed with local1. to the local file /var/log/apache.log
and then:
local1.* ##splunk.myserver.com:8002
where my splunk server is set to listen for tcp connections on port 8002.
I haven't made an attempt at drush yet. The problem is that apache is logging fine to the previous setting to log to /var/log/httpd/error_log, but after I make my changes nothing goes to /var/log/apache.log or to my splunk server.
I restart both rsyslog and apache after making my changes to conf files.
I met the same thing
I fix it follow this: 1 make a error log, like access http://192.168.1.10/sadaf.php. Then to see the /var/error.log have it?
If have it, I test splunk server use port 514,and the sourcetype use syslog.
You can try it.

Override HTTP 500 Internal Server Error in Apache

I am following the article Custom error pages in Apache for JBoss AS7 to configure apache to override HTTP 500 Internal Server Error. I am facing below problem, any guess what's the issue?
In #2 in the above linked article
# (4) Setting error code 404 for "MyApp" application
JkMount /MyApp/* nodeA;use_server_errors=404
In windows env it works where it points to jboss directly
JkMount /MyApp/* jboss7;use_server_errors=500
But in linux where it points to load balancer
JkMount /MyApp/* loadbalancer2;use_server_errors=500
This gives me error:
jk_handler::mod_jk.c (2372): Could not find a worker for worker name=loadbalancer2;use_server_errors=500
Windows apache version is 2.2.17, linux apache version is 2.5.1.
I found out the problem, it is due to the older version of mod_jk. The flag 'use_server_errors' was introduced in mod_jk 1.2.27. In my case linux Apache 2.5.1 has mod_jk 1.2.26 that's why it reads 'loadbalancer2;use_server_errors=500' as a whole. It works in windows because there Apache 2.2.17 has mod_jk 1.2.28 which knows to separate the flag from worker name.