If you are using SELinux (Security-Enhanced Linux), it has a default setting that blocks HTTP servers from making network connections. For example I’m using CentOS 8 and couldn’t figure out why my server couldn’t connect but whenever I logged in I was able to.
This will allow connections to be made:
sudo setsebool -P httpd_can_network_connect true
After this you may need to restart your service.
This might be your issue if you’re able to “curl” and “ping” without problem as a user, but your webserver (Apache, Nginx, etc) isn’t able to.
This solved my issue. Much more to learn about CentOS. Thanks @igienger!
-
This reply was modified 5 years, 6 months ago by spacecadet404. Reason: Forgot to credit solution