2

I am trying to use mod_proxy with httpd and tomcat. If I leave tomcat ajp to run on 8009 in the server.xml of tomcat and in the httpd.conf of apache httpd everything works great but once I change it to anything else and restart them both it does not work.. I trieded 8109,8209 and 8019.. only thing that works is 8009?

Below is my setup that works.

<Proxy balancer://testcluster stickysession=JSESSIONID>
BalancerMember ajp://127.0.0.1:8009 min=10 max=100 route=node2 loadfactor=1
</Proxy>

ProxyPass /examples balancer://testcluster/examples

<Location /balancer-manager>
SetHandler balancer-manager
AuthType Basic
AuthName "Balancer Manager"
AuthUserFile "/etc/httpd/conf/.htpasswd"
Require valid-user
</Location>

if I change the port to anything in here and the server.xml of tomcat it does not work but I can telnet the port so I know its up?

below are the other libs settings I have

LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_alias_module modules/mod_authn_alias.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule ldap_module modules/mod_ldap.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule expires_module modules/mod_expires.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule info_module modules/mod_info.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule rewrite_module modules/mod_rewrite.so

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so

#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so


#LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule cache_module modules/mod_cache.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule disk_cache_module modules/mod_disk_cache.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule version_module modules/mod_version.so

2 Answers 2

2

I can't comment yet so I have to write here... What OS are you using? maybe it's SELinux if you are on RedHat or CentOS. Try running 'setenforce 0' to temporarily disable it and see if that helps.

Edit: Since 'setenforce 0' helped, you can disable SELinux by editing '/etc/sysconfig/selinux':

#This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled

This will disable SELinux after reboot.

4
  • 1
    I am using Scientific Linux release 6.2 Dec 4, 2012 at 18:46
  • it looks like it works once I do a setenforce 0. can you please tell me what this means. Dec 4, 2012 at 19:54
  • SELinux (or Security-Enhanced Linux) is a special security layer implemented in the linux kernel [en.wikipedia.org/wiki/Security-Enhanced_Linux]. Among other things it prevents certain applications from accessing non default ports. Dec 4, 2012 at 21:50
  • Rather than disabling SELinux, you should use audit2allow or relabel the port. SELinux provides defense-in-depth against security issues. Dec 4, 2012 at 23:00
0

Try add this port to allowed ports:

semanage port -a -t http_port_t -p tcp 8109

To list allowed ports use:

semanage port -l | grep -w http_port_t

Default settings are:

http_port_t                    tcp      80, 81, 443, 488, 8008, 8009, 8443, 9000

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .