SELINUX – Apache Mod_proxy ‘[Error] (13)Permission Denied’ Error on RHEL

Smart Techie

We have configured Apache as a load balancer for two apache tomcat instances.

The tomcat instance1 is running on ajp port 8009 and the instance2 is running ajp port 8109

And the tomcat instances are running without having any errors in the log and when we send the request to individual instances, both of them are processing the requests perfectly.

When we send the requests via apache, then, all the requests are routed to instance1. and the requests are not reached to insatnce2.

When we investigated the logs of Apache, we saw the below error messages.

[Thu Feb 28 08:07:08 2013] [error] (13)Permission denied: proxy: AJP: attempt to connect to 10.137.111.12:8109 (10.137.111.12) failed

[Thu Feb 28 08:07:08 2013] [error] ap_proxy_connect_backend disabling worker for (10.137.111.12)

[Thu Feb 28 08:07:08 2013] [error] proxy: AJP: failed to make connection to backend: 10.137.111.12

Here the root cause is SELinux. The solution is to disable the SELinux or change the mode from enforce to permissive.

To change the mode from enforce to permissive follow the below command

setenforce 0

To disable SELinux edit the file/etc/sysconfig/selinux and change the SELINUX line to SELINUX=disabled then reboot the system

Or You can change the default policy

/usr/sbin/setsebool -P httpd_can_network_connect 1

After the above settings, restarted the Apache. Then onwards the apache is routing the requests to both the instances.

Advertisement

Siva Janapati is an Architect with experience in building Cloud Native Microservices architectures, Reactive Systems, Large scale distributed systems, and Serverless Systems. Siva has hands-on in architecture, design, and implementation of scalable systems using Cloud, Java, Go lang, Apache Kafka, Apache Solr, Spring, Spring Boot, Lightbend reactive tech stack, APIGEE edge & on-premise and other open-source, proprietary technologies. Expertise working with and building RESTful, GraphQL APIs. He has successfully delivered multiple applications in retail, telco, and financial services domains. He manages the GitHub(https://github.com/2013techsmarts) where he put the source code of his work related to his blog posts.

Tagged with: , , ,
Posted in apache
3 comments on “SELINUX – Apache Mod_proxy ‘[Error] (13)Permission Denied’ Error on RHEL
  1. Yesu Raj says:

    Thanks Siva… It resolved our issue while setting up http://www.gotchya.co in AWS.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Dzone.com
DZone

DZone MVB

Java Code Geeks
Java Code Geeks
OpenSourceForYou
%d bloggers like this: