MyTrueHost launched Web Hosting for Indian clients just in Rs 60/Month with various payment options(netbanking, debit card, credit card,cash card or paypal).
Please Visit at https://www.mytruehost.in

Accessing Cpanel or Webmail on port 80

Sometimes customers complain about not being able to access Cpanel/Webmail as they are behind some firewall blocking the ports 2082 or 2095. If it is something that cannot be unblocked, then the only solution is to accesss the control panel/webmail via port 80.

There is a script called cpanelproxy.php that help us to configure it. It is very simple to set up.

For control panel, follow the steps.

1. Create subdomain cpanel.domain.com
2. Download the script from http://cpanelproxy.net/cPanelProxy.zip and unzip it into folder
“public_html/cpanel”
3. The control panel can then be accessed via port 80 as http://cpanel.domain.com

Perhaps, you may get the following error while accessing the subdomain. Don’t panic, make sure that the file cpanelproxy.php has read permission to the world.

Warning: Unknown(/home/<user>/public_html/cpanel/cpanelproxy.php): failed to open stream: Permission denied in Unknown on line 0

Warning: (null)(): Failed opening ‘/home/<user>/public_html/cpanel/cpanelproxy.php’ for inclusion (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in Unknown on line 0

Now you can access the control panel on port 80. If the user wants to access it on port 2082, he can still access it with URL http://domain.com/cpanel

Similarly, for webmail just create the subdoamin webmail.domain.com and unzip it into that folder. Thats all!

 

Upgrade Perl to 5.8.8 (Cpanel 11.4.2)

The cpanel 11 requires perl version  5.8.8. To upgrade the perl version in the server you can use following steps:-

1. Download perl 5.8.8 using following link:-

    [root@serv ~]# wget http://layer1.cpanel.net/perl588installer.tar.gz

2. Untar the tar package using following command

 [root@serv ~]# tar -vzxf perl588installer.tar.gz

3. Then Install

 [root@serv ~]# cd perl588installer
  [root@serv ~]# ./install

Once this has completed, execute the following to ensure that all modules
required by cPanel are installed, and restart cPanel:

   [root@serv ~]# /usr/local/cpanel/bin/checkperlmodules
  [root@serv ~]# /usr/local/cpanel/startup

4. Check and confirm the perl version using the command:

 [root@serv ~]# perl -v

 

Alternative PHP cache (APC)

Alternative PHP Cache (APC) is a PHP extension for caching data and compiled code from php accelerator. It helps to improve the performance of the webserver. The steps to install APC in cpanel are as follows:

# cd /usr/local/src
Get the latest version of APC,

# wget http://pecl.php.net/get/APC-3.0.14.tgz
# tar -zxvf APC-3.0.14.tgz
# cd APC-3.0.14

You can find the path of phpize and php-config using which command.

#which phpize
#/usr/local/bin/phpize
#which php-config
#/usr/local/bin/php-config

Now use these details to complete installation.

# /usr/local/bin/phpize
# ./configure --enable-apc --enable-apc-mmap --with-apxs --with-php-config=/usr/local/bin/php-config
# make
# make install

Add the following lines within the Dynamic Extensions section of php.ini as given below.

*********************
extension=apc.so
apc.shm_size = 32
;Windows Extensions
*********************

Restart httpd. Now you can see the apc section enabled in phpinfo() page.

Note :

After make install, you will get the extension path like this,

extension="/usr/local/lib/php/extensions/no-debug-non-zts-20020429/apc.so"

confirm whether extension directory is defined in php.ini.

extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20020429"

If not you should give the full path in php.ini instead of just ‘extension=apc.so’. Like this,

extension="/usr/local/lib/php/extensions/no-debug-non-zts-20020429/apc.so"


							

Creating a Ruby On Rails application in Cpanel

Ruby On Rails icon is there in cpanel theme from cpanel 11 onwards.
You can create a Ruby On Rails application in cpanel by following steps given below.

1. Login to cpanel
2. Click on the Ruby On Rails Icon in cpanel.
3. Fill in the “App Name” box with the application name you want to use.
4. Check the box for “Load on boot’.
5. Application Path will be automatically filled in as public_html/application_name.

You can create the application in this location itself. But, if you are installing this inside public_html, the configuration files will be public and everyone can access it. In order to avoid this, change the permission of the configuration files to 600. The main configuration file in which mysql passwords are stored is database.yml(Path: path_to_application/config/database.yml).

Or, you can install the application outside the public_html directory(in the home directory itself). Then you should set redirect to this application through apache to  the mongrel port from the cpanel >> Ruby On rails>>Redirects. Mongrel is the default webserver for RoR applications, which will be installed in the server when we install ruby using using /scripts/installruby.

6. Select the environment. The default environment in which the application will be created is ‘production’.

7. Click “Create”.

Application will be created in the specified path. All the newly created application will be using a port(>12000).

If the application name is test and  installation directory /home/username/public_html/test, then you can access the application using http://domainname/test/public/ (Use ‘/’ at the end which is the good method).

 

 

MySQL Root Password Reset

When you try to install mysql using rpm  then some times you have faced password authentication problem. This is not an issue, it means your mysql server is working fine but need authentication to access it. So let us do the following:-

$ pkill -9 mysql

This is for killing the mysql process running in the server.

cat /root/.my.cnf

Please read the password from the above file, if it is cpanel server.

Now do the following command in the mysql prompt:-

$/usr/libexec/mysqld –skip-grant-tables –user=root &

This skip-grant-tables option causes the server not to use the privilege system at all. This gives anyone with access to the server unrestricted access to all databases.

Go back into MySQL with the client:

MySQL > UPDATE user SET Password=PASSWORD(‘YOUR_PASSWORD’)  WHERE Host=’localhost’ AND User=’root’;

You have now reset mysql root in the server. So you need to kill all the mysql process following command:-

$ killall mysqld

Start MySQL the normal way for your system.

/etc/init.d/mysqld start

You can now access mysql and  login as root using the password which you have set using UPDATE command.

Cpanel/WHM: License expired error

If “License expired” error is encountered while accessing the cpanel/whm, it can be fixed by following below mentioned steps:

1. Check whether the license is expired.

This is the most obvious cause and simple to verify. Access the URL ‘http://verify.cpanel.net/’ and check the IP of the server.

2. If it is “active”, Run the following command:

  $ /usr/local/cpanel/cpkeyclt

This should promptly return to the command line with no messages. If it takes a while, then there is likely a connectivity issue between your server and the licensing server.

3. In that case, check whether the firewall is blocking connections to the licensing server.

Verify that port 2089 TCP outgoing traffic is allowed in the firewall rules.

4. If you’re not sure that your firewall is properly configured, then the best thing to do is temporarily flush your firewall rules.  Before flushing the firewall rules, you need to save the firewall rules enabled in the server.

$ /etc/init.d/iptables save

After that you can flush your firewall rules using the command

$ iptables -F

After that, do the step 2 once again.

 

Basics Of cPanel : Access Information

cPanel is a control panel used in the server to handle different functionalities of a domain. This control panel is highly useful in web hosting industry. cPanel is used for server administration as well as domain administration.

The server wide control panel is named as WHM(WebHost Manager) and the domain wise control panel is cPanel


How to access cPanel/WHM


WHM

htttp://IP/whm OR
http://IP:2086/ OR
http://hostname/whm OR
http://hostname:2086/

WHM uses 2086 and 2087 ports
2086  -> For normal access
2087  -> For secured access

When the login prompt comes, we have to enter Username as root and Password as root password. If we want to access a reseller account, we have to enter Username as reseller name and Password as the password provided to the reseller.

cPanel
http://IP/cpanel OR
http://IP:2082/ OR
http://domain_name/whmOR
http://domain_name:2082/

cPanel uses 2082 and 2083 ports
2082  ->  For normal access
2083  ->  For secured access

When the login prompt appears, enter the username as domain user and password as the password set to that user.

How to access webmail


One can access mail by entering the URL
http://IP/webmail OR
http://IP:2095/ OR
http://domain_name/webmail OR
http://domain_name:2095/ OR

cPanel webmail ports are 2095 and 2096
2095 for normal access
2096 for secured access

Basically cpanel uses two types of webmail
a. Horde
b. Squirrelmail
c. Roundcube / NeoMail

How to access MySQL


phpMyAdmin tool is used in cPanel to manage mysql databases.

We can access phpMyAdmin in the following ways
1) http://domain_name:2082/3rdparty/phpMyAdmin/

While accessing, you will be prompted to enter the login credentials of the cpanel user.

 

 

Block IP addresses from accessing the site

You can block IP addresses from accessing the site by adding the following lines in .htaccess file.

order deny,allow
deny from 192.168.1.40

The order directive set the order in which the allow and deny directives will be processed and also the default access control state. In the above case, the default access control state is allow, which means everyone can access the site and the deny directives will be processed before the allows. It is possible to specify more than one deny or allow directives, like

order deny,allow
deny from 192.168.1.40
deny from 192.168.1.41

It will block access from those IPs to the site. It is also possible to specify partial IP address, like

order deny,allow
deny from 192.168.1

In this case, it will block the access from 192.168.1.0 – 192.168.1.255 range.

We can also specify IP range in network/netmask or CIDR notation, like

order deny,allow
deny from 192.168.1.0/255.255.255.0 or deny from 192.168.1.0/24

In the above exmaples, all type of http methods will be blocked from those IP addresses. If you only want to restrict certain methods say POST, PUT, DELETE from the IP address, you need to use the limit directive.

<Limit POST PUT DELETE>
order deny,allow
deny from 192.168.1.40
</Limit>

Hide apache web server version

It is possible to hide apache web server version and other information.  This is done for security reasons. It is not a good idea to broadcast the version of the software that you are running on the server. You should have noticed the following details(or something similar) when an error page is displayed.

Apache/2.2.9 (Unix) mod_ssl/2.2.9 OpenSSL/0.9.8b mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.6 Server at XXX.com Port 80

 Add/Edit the two entries in the apache configuration file(httpd.conf)

ServerSignature Off
ServerTokens Prod

ServerSignature Off : tells apache not to display the server version on error pages, or other pages it generates.
ServerTokens Prod :  tells apache to only return Apache in the Server header, returned on every page request.

Restart the webserver.

$ service httpd restart

 

 

Adding PHP RSS feeds to your website

RSS means Really Simple Syndication. This is used to publish frequently updated content such as blog entries, news headlines etc. An RSS document or a “feed” contains a summary of content from an associated web site. Adding RSS feeds to your web pages with PHP will provide fresh content for the search engines to give better rank for your sites. This is an advantage over RSS in Javascript which is not search engine friendly. Adding the code to html, php and shtml pages have been described below:-

How to add PHP RSS code to an HTML site

1) Create a file say, rssfeeds.php. Add the PHP code that was given to you by the RSS reader to this file and save this in the root directory of the website.

2) Add the following SSI call to your web pages where ever you want to display RSS headlines:-


<!–#include virtual=”/rssfeeds.php” –>

3) Add the following lines of code in a .htaccess file:

.htm server parsed
.html server parsed
OR

Addhandler application/x-httpd-php .html .php

How to add PHP RSS code to a PHP site

Here you need to add the PHP code produced by the RSS reader to your PHP pages without modifying it. You may add this in the page anywhere that you want to display the headlines. There is no need for editing the .htaccess file.

How to add PHP RSS code to a SHTML site

Add the following SSI code to your pages where ever you want the headlines to appear:

<!–#include virtual=”/rssfeeds.php” –>

Now, create a file on the root directory of your website called rssfeeds.php and copy the PHP code produced by the RSS reader into this file. There is no need for editing the .htaccess file.