Saturday, November 19, 2011

Change the location of MySQL , vhosts , qmail to /home in plesk

1) Stop Plesk and all services.

2) Change HTTPD_VHOSTS_D in psa.conf, for example /var/www/vhosts -> /home/httpd/vhosts.

3) Move vhosts to new location, for example /var/www/vhosts to /home/httpd/vhosts.

4) Create symlink:
ln -s /home/httpd/vhosts /var/www/vhosts

5. start httpd

6. Reconfigure Apache configuration with new path:

~# /usr/local/psa/admin/sbin/websrvmng -a -v
==================================================
How to change location of mail maildirs

Friday, November 11, 2011

how to disable php safe mode

how to disable php safe mode

Solution: turn off safe mode by modifying your httpd.conf file:
1. find your vhost entry
2. add to that vhost entry: php_admin_flag safe_mode Off

How to Disable Statistics for a Certain User via WHM

You can disable a stats program for a specific user by following the steps below via your WHM:

1. Login to WHM then go to Main >> Server Configuration >> Statistics Software Configuration

2. Under User Permissions click "Choose Users."

3. On the next page that loads, after "Choose Specific Stats Programs for" enter the desired username then click "Configure."

4. The following page will allow you to select the stats programs that the user may use; to finalize and submit changes click "Save."

Monday, November 7, 2011

Add SPF records to all domains in Plesk

To add SPF records to every domain in Plesk, you can use this huge one-liner:

mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -e "select dns_zone_id,displayHost from dns_recs GROUP BY dns_zone_id ORDER BY dns_zone_id ASC;" | awk '{print "INSERT INTO dns_recs (type,host,val,time_stamp,dns_zone_id,displayHost,displayVal) VALUES ('\''TXT'\'','\''"$2"'\'','\''v=spf1 a mx ~all'\'',NOW(),"$1",'\''"$2"'\'','\''v=spf1 a mx ~all'\'');"}' | mysql -u admin -p`cat /etc/psa/.psa.shadow` psa

Then you'll need to make Plesk write these changes to the zone files:

# mysql -Ns -uadmin -p`cat /etc/psa/.psa.shadow` -D psa -e 'select name from domains' | awk '{print "/usr/local/psa/admin/sbin/dnsmng update " $1 }' | sh

You can check your work by viewing the new entries you made:

mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -e "SELECT * FROM dns_recs WHERE type='TXT';"

Saturday, October 29, 2011

webmail or whm redirecting to cpanel default page

Check apache conf and dns entry for the domain having issue.

if there is any missing entries in apache conf

Take a copy of the apache conf and rebuild the conf.

make the below changes on whm > tweak settings.

> Domains > Proxy subdomains [?] > on

Proxy subdomain creation [?] > on

Proxy subdomain override [?] > on

link mysql to /home

How to Change the location of MySQL:

1) Stop MySQL using command: service mysql stop
2) cp /var/lib/mysql /home/mysql
3) vi /etc/my.cnf

change the below settings.

[mysqld]
set-variable = max_connections=500
datadir = /home/data/mysql
pid-file = /home/mysql/mysqld.pid
skip-locking
safe-show-database
skip-bdb
old_passwords=1
long_query_time=2
log-slow-queries=/var/log/mysql-slow-queries.log
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
max_user_connections=50
max_connections=500
thread_cache_size=256
table_cache=8192
key_buffer=64M
max_connect_errors=20
max_allowed_packet=128M
join_buffer=2M
record_buffer=1M
sort_buffer_size=2M
read_buffer_size=2M
read_rnd_buffer_size=1M
thread_concurrency=16
myisam_sort_buffer_size=64M

then save the file

4) chown -R mysql:mysql /home/mysql
5) rm /tmp/mysql.sock
6) ln -s ../../home/mysql/mysql.sock /tmp/mysql.sock
7) Run Command: service mysql restart

Now MySQL should be successfully started and operating from the location /home/mysql

You can remove the old mysql directory by using rm -rf /var/lib/mysql