web analytics

Plesk for Linux – Fixing .htaccess pcfg_openfile error – permission fix

Written by config on . Posted in Linux, Ubuntu

Advertisement

Problem with directory / files permissions after installing some software on your Plesk Linux server ( Nagios for example known to cause this in certain scenarios ).

From /var/www/vhosts/domain.com/statistics/logs/error_log :

[critical] [client 192.168.0.13] (13)Permission
denied: /var/www/vhosts/domain.com/httpdocs/.htaccess pcfg_openfile:
unable to check htaccess file, ensure it is readable

You will see Forbidden Error in your browser.

If you check the mentioned location you will notice that .htaccess file is probably not even there. Creating it and giving it the correct permissions won’t help of course.

In our case permissions set wrong on the httpdocs / httpsdocs directory itself.
Try this to fix:

cd /var/www/vhosts/domain.com/
chmod 755 httpdocs
chmod 755 httpsdocs

You don’t have to set the permissions to 755 as 751 for example will work as well. Play with the permissions on httpdocs to find the suitable solution.

Plesk for Linux – Disabling mod_security rules for specific directory

Written by config on . Posted in Linux, Ubuntu

If you are working with Plesk Control Panel ( Linux version ) and mod security – you probably encountered some problems with specific scripts. Sometimes mod security block certain functions of the script because it thinks it is malicious code.

For example this warning taken from Apache log:

Warning. Match of "rx ^apache.*perl" against "REQUEST_HEADERS:User-Agent" required. [file "/etc/httpd/conf.d/modsecurity/modsecurity_crs_35_bad_robots.conf"] [line "27"] [id "990011"]

Lets say you want to leave mod_security as it is without removing it or disabling on the server, what you want to do is to disable this specific rule (“990011″) for the specific directory in the domain and let your scripts work as it should.
Here is a quick solution.

Create a file called vhost.conf in /var/www/vhosts/domain.com/conf
containing the following:

<Directory /var/www/vhosts/domain.com/httpdocs> SecRuleRemoveByID 990011 </Directory>

Then run this in terminal:

/usr/local/psa/admin/bin/websrvmng -u --vhost-name=domain.com
service httpd restart

This is specific to Redhat/Centos.
If you cannot find websrvmng in the mentioned path you can try:

updatedb
locate websrvmng

Also pay attention that if you use Debian and Ubuntu or their derivatives, you cannot use the service command and your apache is not httpd.
Try to use

/etc/init.d/apache2 restart

Grub2, problem booting after kernel update

Written by config on . Posted in Linux, Ubuntu

If you are using grub2 ( arch linux or ubuntu 9.10 karmic koala ) you might notice some problems after kernel updates.

Symptoms – System won’t boot and you will get error similar to this:

Error – you need to load the linux kernel first.

Quick solution would be to boot from Arch / Ubuntu CD and go to recovery, mount your boot partition and get root shell ( You usually got all this in Ubuntu recovery menus, in Arch you might wanna use the shell ;) . Go to /boot/grub and edit device.map ( what probably went wrong is that your hdd definition changed in this file and its currently trying to boot from wrong drive ). In my case changing /dev/sda to /dev/sdb  solved the problem. Do not forget to run update-grub2 to re create grub.cfg and reboot. Your system should boot as usual :)

Ubuntu 9.10 Karmic Koala Alpha – Ctrl+c in ssh terminal

Written by config on . Posted in Linux, Ubuntu

Seems like Ubuntu dev folks decided to change some functionality of the Ctrl-c shortcut so now it is copy function instead of break.

Anyway there is a bug open here: https://bugs.launchpad.net/ubuntu/+bug/402973

My install is ( lsb_release -a ):

Description:    Ubuntu karmic (development branch)
Release:        9.10

uname -a ( date and time stripped )

Linux psy-srv 2.6.31-3-generic-pae #19-Ubuntu SMP i686 GNU/Linux

Its Alpha 3 of Ubuntu Karmic Koala Server release.

Report the annonying bug !