buy tadalafil

Archive for the ‘How to’ Category

Remove IP from Brute Force Protection

Monday, February 22nd, 2010

How to remove blocked  ip address from the Brute Force Protection by using SSH  ?

When WHM locks out an user account, especially “root”, the best way is to wait for 10 minutes to see if the account will be unlocked. If the locks persists, webmaster and administrator who still can remote login via SSH to the server as root can manually remove the lockouts via following steps:

mysql> use cphulkd;

 

mysql> BACKUP TABLE `brutes` TO ‘/var/lib/mysql/cphulkd-bak’;

mysql> BACKUP TABLE `logins` TO ‘/var/lib/mysql/cphulkd-bak’;

Above command will backup the brutes table, the main table used by cPHulk to record locked accounts and denied IP addresses.

mysql> DELETE FROM `brutes`;
mysql> DELETE FROM `logins`;

Above commands will remove all blocked IP addresses and locked accounts from the system, enabling full access again

mysql> quit;

 

Done

mysql connection in jsp

Monday, December 14th, 2009

Database Connection by using jsp page .

The URL based mysql connection  is

=================================

jdbc:mysql://serverip address/DATABASENAME?user=USERNAME&password=PASSWORD

=================================

OR

=================================

<!– Database connection settings –>
<property name=”connection.driver_class”>com.mysql.jdbc.Driver</property>

<property name=”connection.url”>jdbc:mysql://localhost/database_name</property>
<property name=”connection.username”>databses_user</property>
<property name=”connection.password”>password</property>

<!– configuration pool via c3p0–>

=================================

OR

=================================

try {
   	Class.forName("com.mysql.jdbc.Driver").newInstance();
 	// here we are connecting to localhost, port 3306.  Change it to your db server address:port
 	con = DriverManager.getConnection("jdbc:mysql://localhost:3306/databaseName",
         	"root", "secret");
 	//or  con = DriverManager.getConnection("jdbc:mysql://localhost:3306/databaseName?user=
 		root&password=secret";
 }
 catch(Exception e){
 		System.out.println(e.getMessage());
 	}
=================================

How to update webalizer?

Friday, December 11th, 2009

Some time the webalizer is not updated automatically , at that time you need to update the webalizer manually by using following command.

/usr/local/cpanel/3rdparty/bin/english/webalizer  -N  10  -D  /home/username/tmp/webalizer/dns_cache.db -R 250 -p -n domain.com -o  /home/username/tmp/webalizer   /usr/local/apache/domlogs/domain.com

Note : Replace username equal to correct username and domain.com equal to correct domain name.


Redirection from http to https

Wednesday, November 25th, 2009

How to Redirect from http to https URL.

If the ssl is installed on the server and you want to all the request redirected to https then you need to add the folloing code in .htaccess file.

============================

RewriteEngine on
Options +FollowSymLinks
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

============================

or

============================

RewriteEngine on
Options +FollowSymLinks
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://www.domain.com [L,R]

============================

done

Accessing perl file without .pl extention

Sunday, November 22nd, 2009

How to Access  perl script file without .pl extention

for example: http://192.168.o.2/~test/cgi-bin/testperlpath.pl

here in this case client want to access testperlpath.pl file without .pl extention like

http://192.168.o.2/~test/cgi-bin/testperlpath

then you need to add handler in .htaccess file

<Files ~ ‘^[^.]*$’>
SetHandler cgi-script
</Files>

Done

How to disable Core file generation

Sunday, November 22nd, 2009

How to disable Core file generation

first of all delete the core files which are preset on the server or under any account
then

vi /etc/init.d/httpd

and below the “ulimit -n 16384″ you need to put

ulimit -c 0

And Command to delete core files

#find ./ -name “core.*” -exec rm -f {} \;

How to compress CSS with gZIP

Friday, November 20th, 2009

How to compress my CSS with gZIP?

To compress your CSS files with gZIP there are two things that you should do.

First, add the following line to the .htaccess file in your public_html folder:

AddHandler application/x-httpd-php52 .css

By doing this, you allow the server to process .css files through PHP.

Next, add the following lines at the very beginning of your .css file(s):

<?php
ob_start (“ob_gzhandler”);
header(“Content-type: text/css; charset: UTF-8″);
header(“Cache-Control: must-revalidate”);
$offset = 60 * 60 ;
$ExpStr = “Expires: ” .
gmdate(“D, d M Y H:i:s”,
time() + $offset) . ” GMT”;
header($ExpStr);
?>

By doing this, you will enable the gZIP compression for your CSS file. For bigger websites there will be a significant improvement in the loading speed of your pages.

How to disabled the suhosin for the perticular domain

Thursday, November 19th, 2009

How to disabled the suhosin for the perticular domain

search suhosin in php.ini file
=============================
extension=”suhosin.so”

; Filtering Options
suhosin.get.max_vars = 114096
suhosin.post.max_vars = 114096
================================
and change it to

==========================
;extension=”suhosin.so”

; Filtering Options
;suhosin.get.max_vars = 114096
;suhosin.post.max_vars = 114096
==============================

How to Upgrade from moodle 1.8 to 1.9

Thursday, November 12th, 2009

Upgrade from moodle 1.8 to 1.9 (with Nwiki upgrade)

A very quick how to to upgrade moodle 1.8 to moodle 1.9 (with Nwiki upgrade from 1.8 to 1.9):

1. Stop you moodle 1.8 (mantainence mode)
2. Copy your moodle BD (ispconfig is great for this) to a new one (here is dbmoodle19)
3. cp /home/public_html/moodle18 /home/public_html/moodle19
4. cd /home/public_html/moodle19 | wget http://download.moodle.org/stable19/moodle-weekly-19.tgz
5. tar xvzf moodle-weekly-19.tgz
6. cp moodle/* . -a
7. rm moodle -Rf
8. Review your config.php: vim /home/public_html/moodle19/config.php (dbusers | dbtables | urls | paths)
9. Visit your new Moodle to start the upgrade to 1.9 process: http://www.yoursite.net/moodle19
10. Follow the wizard and congratulations: your moodle is now 1.9 !!
11. Download nWiki 1.9 and upload to your server: http://morfeo.upc.es/crom/mod/resource/view.php?id=268
12. unzip & copy to your moodle root.
13. Visit your moodle notifications page and follow the wizard.
14. Congratulations your Nwiki is also updated.

How to Redirect a Web Page Using a 301 Redirect

Wednesday, October 28th, 2009

How to Redirect a Web Page Using a 301 Redirect

You’ve just edited or modified some pages of your web site and those pages
have high search engine rankings that you don’t want
to lose. How can you safely redirect web site traffic from
your old pages to the new pages without losing your
rankings? You can do this by using a ” 301 redirect “.

Introduction to “What is 301 redirect?”

301 redirect is the best method to maintain your current
search engine rankings when redirecting web pages or a web
site. The code “301″ is interpreted as “moved permanently”.
After the code, the URL of the missing or renamed page is
noted, followed by a space, then followed by the new
location or file name. You implement the 301 redirect by
creating a .htaccess file.

What is a .htaccess file?

An htaccess file is a simple ascii text file which you create or edit in a text editor. The dot (.) before the word htaccess indicates that .htaccess is  a file extension.When a visitor/spider requests a web page, your web server checks for a .htaccess file. The .htaccess file contains
specific instructions for certain requests, including
security, redirection issues and how to handle certain
errors.

How to implement the 301 Redirect

1. To create a .htaccess file, open notepad, name and save
the file as .htaccess (there is no extension).

2. If you already have a .htaccess file on your server,
download it to your desktop for editing.

3. Place this code in your .htaccess file:

redirect 301 /old/old.htm http://www.you.com/new.htm

4. If the .htaccess file already has lines of code in it,
skip a line, then add the above code.

5. Save the .htaccess file

6. Upload this file to the root folder of your server.

7. Test it by typing in the old address to the page you’ve
changed. You should be immediately taken to the new
location.

Notes: Don’t add “http://www” to the first part of the
statement – place the path from the top level of your site
to the page. Also ensure that you leave a single space
between these elements:

redirect 301 (the instruction that the page has moved)

/old/old.htm (the original folder path and file name)

http://www.you.com/new.htm (new path and file name)

When the search engines spider your site again they will
follow the rule you have created in your .htaccess file.
The search engine spider doesn’t actually read the
.htaccess file, but recognizes the response from the
server as valid.

During the next update, the old file name and path will be
dropped and replaced with the new one. Sometimes you may
see alternating old/new file names during the transition
period, plus some fluctuations in rankings. According to
Google it will take 6-8 weeks to see the changes reflected
on your pages.

Other ways to implement the 301 redirect:

1. To redirect ALL files on your domain use this in your
.htaccess file if you are on a unix web server:

redirectMatch 301 ^(.*)$ http://www.domain.com
redirectMatch permanent ^(.*)$ http://www.domain.com

You can also use one of these in your .htaccess file:

redirect 301 /index.html http://www.domain.com/index.html
redirect permanent /index.html http://www.domain.com/index.html
redirectpermanent /index.html http://www.domain.com/index.html

This will redirect “index.html” to another domain using a
301-Moved permanently redirect.

2. If you need to redirect http://mysite.com to
http://www.mysite.com and you’ve got mod_rewrite enabled on
your server you can put this in your .htaccess file:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]

or this:

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

Tip: Use your full URL (ie http://www.domain.com) when
obtaining incoming links to your site. Also use your full
URL for the internal linking of your site.

3. If you want to redirect your .htm pages to .php pages
andd you’ve got mod_rewrite enabled on your server you can
put this in your .htaccess file:

RewriteEngine on
RewriteBase /
RewriteRule (.*).htm$ /$1.php

4. If you wish to redirect your .html or .htm pages to
.shtml pages because you are using Server Side Includes
(SSI) add this code to your .htaccess file:

AddType text/html .shtml
AddHandler server-parsed .shtml .html .htm
Options Indexes FollowSymLinks Includes
DirectoryIndex index.shtml index.html