Allow nginx to access a remote DB on a Centos

If you try to access a remote database with nginx or httpd server, you will have a connection problem with error code (13) even if mysql/mariadb client works well in command line. The reason for that is a security limitation set by default not allowing httpd servers sur connect a remote DB.

To disable this limitation and make all work, just type in the command line :

# setsebool -P httpd_can_network_connect 1

You can list all the existing flags for httpd by using getsebool

# getsebool -a | grep httpd

In case you expect SELinux to be the cause of your problem, you can enable / disable it with the following functions

# setenforce 1
# setenforce 0

If you need to check what is the permission missing for SELinux you can run the audit

# tail -100 /var/log/audit/audit.log | audit2allow

Use node & javascript for web crawling

I recently have to crawl the web to get some data from a website, even if I’m more a Java addict and convinced that JavaScript is the 21 century basic, this language seemed to be the more efficient way to do this task.

I discovered for this purpose the use if crawler : a javascript library for node.js

This post details this experimentation.

Continue reading

WordPress can’t establish connection with DB

I just got an error message coming from wordpress saying on the index page that the connection to the database is not possible. I expected a problem in the connection chain but the real issue was related to a corrupted table in the database.

This as been fixed by repairing this table. So take care of the messages that can be wrong in the index page. The message in the admin index page was better concerning this point.