Category Archives: Apache

Painful bug with apache2-mpm-itk –Apache randomly returns 403 Forbidden

Painful bugToday to my great surprise I notices that my Apache web server randomly returns 403 Forbidden HTTP error code to search engine robots. Yandex Search Engine reported that on my favorite website 263 pages are OK and 210 pages has 403 status and some other site has 394/139 pages respectively.

In Apache error logs I found the following messages:

Permission denied: /home/<site-name>/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

as far as I see they appears whenever this 403 error is reported.

(more…)

Restricting the access to phpmyadmin in Apache 2 on Ubuntu

By default Apache 2 is configured in a way that phpmyadmin is automatically included to all the hosted web sites. For example, if I create a new site ‘site.com’, and then navigate to this address:

http://site.com/phpmyadmin

the phpmyadmin login page appears.

(more…)

Securing Apache web server on Ubuntu Linux

Running Apache virtual hosts as different users

By default, Apache on Ubuntu executes all PHP scripts under www-data user, hence in situations where multiple mutually distrusting users have the possibility to put their PHP scripts on the server they could potentially spy on each other private data.

For example, the user user1 could put a PHP script that access file ‘file1.txt’ belonging to user2:

echo file_get_contents("/home/user2/www/file1.txt");

(more…)