Thursday, September 24, 2009

To view System Information

Print system information, print information about the machine and operating system it is run on.

uname -a

To view hostname : cat /proc/sys/kernel/hostname
Read More !

Friday, September 18, 2009

How to setup sender policy framework (spf) in plesk

Login to Plesk
Goto Domains -> your Domainname.com -> Dns Settings -> Add record
Choose Record type as : Txt
Leave the domain name as blank
(generate spf record from any online wizard or by default you can add "v=spf1 a mx ~all")
Enter Txt record value : "v=spf1 a mx ~all"
Read More !

Wednesday, September 16, 2009

How to reset mysql root password in linux

Stop the mysqld daemon process:
/etc/init.d/mysql stop

Start the mysqld daemon process with the --skip-grant-tables option:
/usr/bin/mysqld_safe --skip-grant-tables

Start the mysql client with the -u root option:
mysql --user=root mysql

Execute the query:
update user set Password=PASSWORD('new-password-here') WHERE User='root';

Execute the FLUSH PRIVILEGES; command:
flush privileges;

Exit the mysqld daemon process:
exit

Start the mysqld daemon process:
/etc/init.d/mysql start

Read More !

How to create symlinks in linux

How to creating Symbolic Links in linux

ln -s source destination
example: ln -s httpdocs httpsdocs

This creates a symlink for httpsdocs -> httpdocs

To change permission of symlinks
chown -h owner:group directory

Read More !

Tuesday, September 15, 2009

How to set redirect using .htaccess

To redirect the whole website
Redirect 301 / http://www.domainname.com/

To redirect a particular directory
RedirectMatch 301 ^/directoryname/$ http://www.domainname/

To redirect non-www to www
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.domainname\.com$
RewriteRule (.*) http://www.domainname.com/$1 [R=301,L]

To redirect www to non-www
RewriteEngine On
RewriteCond %{HTTP_HOST} !^domainname\.com$
RewriteRule (.*) http://domainname.com/$1 [R=301,L]

Read More !