Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to disable SELinux on web #1

Open
sourcedelica opened this issue Nov 18, 2019 · 2 comments
Open

Need to disable SELinux on web #1

sourcedelica opened this issue Nov 18, 2019 · 2 comments

Comments

@sourcedelica
Copy link

sourcedelica commented Nov 18, 2019

I spent a boatload of time trying to figure out why my web page couldn't connect to the DB.

First I realized that I needed to use an IP address in both the Mysql user permissions and the mysqli_connect call.

But it was still giving me this error on the web page.

2003:Can't connect to MySQL server on '192.168.86.54' (13)  

I tried installing MySQL on the web server and was able to connect using the mysql client.

Finally I found this Stackoverflow article which said to set

setsebool -P httpd_can_network_connect_db=1

That worked. I ended up using this in my playbook.

- selinux:
  state: disabled
@susilkumarjayachandran
Copy link

The below command did the trick for me. Reference stackoverflow

sudo setsebool -P httpd_can_network_connect 1

@matesebi
Copy link

matesebi commented Oct 11, 2021

I spent a lot of time debugging this too, here is the setsebool command as a task:

- name: Allow httpd to connect to DB over the network
  seboolean:
    name: httpd_can_network_connect
    state: true
    persistent: true
  become: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants