Permissions for Joomla using Plesk and Virtuozzo

Filed Under (Joomla! 1.0, Joomla! 1.5, Plesk/Virtuozzo, Ubuntu) by khawaib on 15-08-2010

Tagged Under : , , , , , , , , , ,

Change the umask in ‘/etc/proftpd.conf’ from ’022′ to ’002′.

Then, update the directory permissions by running the following at the command line:

cd /var/www/vhosts/[domain.com]
chown -R [username]:psacln httpdocs
chmod -R g+w httpdocs
find httpdocs -type d -exec chmod g+s {} \;

Add the ‘apache’ user to the ‘psacln’ group by editing ‘/etc/group’.

psacln:x:2524:apache

www or no www in urls

Filed Under (Facebook, Joomla! 1.0, Joomla! 1.5, Ubuntu) by khawaib on 01-08-2010

Tagged Under : , , , , , , , ,

You can enter your website urls with a www or with no www. Which is better I leave for you to google and find out yourself. Using both is not a good idea as search engines and Facebook will not treat them same and will cause problems.

Solution is to force one of them to be used and not both. So if a users enters http://www.youtsite.com gets to http://yoursite.com and vice versa.

Solutions 1: Using Mod Rewrite
Following code should be placed in htaccess file in root directory of your website.

If your want to http://www.yoursite.com use following code:

<IfModule mod_rewrite.c>
   Options +FollowSymLinks
   Options +Indexes
   RewriteEngine On
   RewriteBase /
   RewriteCond %{HTTP_HOST} ^domain\.com$
   RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
</IfModule>

If your want to http://yoursite.com use following code:

<IfModule mod_rewrite.c>
   Options +FollowSymLinks
   Options +Indexes
   RewriteEngine On
   RewriteBase /
   RewriteCond %{HTTP_HOST} ^www\.domain\.com$
   RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
</IfModule>

Joomla website users:
You can use following free plugin from JED
http://extensions.joomla.org/extensions/site-management/url-redirection/10527

chmod directories/files using command line

Filed Under (Ubuntu) by khawaib on 21-05-2010

Tagged Under : , , ,

//Following command will set the permission for all directories only:
find . -type d -exec chmod 755 {} \;
//Following command will set the permission for all files only:
find . -type f -exec chmod 644 {} \;
//To only apply chmod to files with names matching a specified pattern:
find . -type f -name '*.htm*' -exec chmod 644 {} \;
//To restrict to an owner you can also do:
find . -type d -user fileowner -exec chmod 0755 {} \;
//Changing files of only a specific type/extension is:
find ./ -name *.pdf -exec chmod 755 {} \;

Useful Command-Line Tips

Filed Under (Ubuntu) by khawaib on 11-05-2010

Tagged Under :

Change directories command
For relatives path:

cd ../relative/path/directory/file

For absolute paths:

cd /absolute/path/directory/file

Go to home directry from any location: cd~

Listing
To list files of a direcroty
For relatives path:

ls ../relative/path/directory/file

For absolute paths:

ls /absolute/path/directory/file

Options:
-l for list
-A show hidden files

Show current directory

pwd

Copy files from one location to another

cp /files/to/copy /directory/to/copy/to/  

Finding help:

cp --help

for detailed help type man

man mysqldump
[/php]
[php]

Linux server useful commands

Filed Under (Ubuntu) by khawaib on 20-04-2010

Tagged Under : , , ,

Some useful Ubuntu command lines I use often:

Restart Appache

/etc/init.d/apache2 restart

Restart MySQL

/etc/init.d/mysql restart

Find Ubuntu Server Specs

cat /etc/lsb-release

Update the directory permissions

cd /var/www/vhosts/[domain.com]
chown -R [username]:psacln httpdocs
chmod -R g+w httpdocs
find httpdocs -type d -exec chmod g+s {} \;

Collect Statictics data:

/usr/local/psa/admin/sbin/statistics >/dev/null 2>&1