Showing posts with label Linux cPanel Hosting. Show all posts
Showing posts with label Linux cPanel Hosting. Show all posts

What is my motherboard model?

0 comments
dmidecode is a great utility that provides details about the motherboard in your server. Everything from the type of RAM to the model of the motherboard.

Run this command to get the name and model of the motherboard used in your linux server.
 dmidecode | grep -i product

How to Enable GZIP Compress on PHP Websites

1 comments
Compressing a web page been serving it to web browser which requested the web page can save and reduce bandwidthusage. With lesser bytes to transmit and transfer over Internet, a web page request can be fulfilled and transferred faster, freeing up process and resources to handle other requests. The end result is faster website, which improves visitors’ experience and potentially improves search engine ranking.

Most modern web browsers accept web pages encoded in GZIP or Deflate encoding method, with GZIP as the more popular compression format. Webmasters and system administrators are also encouraged to implement GZIP compression.

There are many ways to implement and enable GZIP compression on a website. For example, enable GZIP compress by configuration mod_deflate on Apache HTTPD server (Note: mod_deflate is for Apache 2.x only, while mod_gzip is used in Apache 1.x). However, for users who can’t modify the Apacheconfiguration file, or unfamiliar with various syntax and directives of mod_deflate and mod_gzip modules, there is a simple way to turn on and enable GZIP compression, specifically for PHP scripts.

PHP can compress the content output by the PHP scripts, including HTML, JavaScript and CSS codes which are included inside the PHP files. GZIP compression is supported by default on PHP version 4.3 or newer.

To enable PHP GZIP compression, edit the php.ini (example locations such as in /etc/ or /usr/local/lib) with any text editor such as vi, and locate the following directive:

zlib.output_compression

The default value is Off, change the setting to On to make the line looks like below:

zlib.output_compression = On

Restart Apache HTTPD server after the change. Every web pages produced by PHP will now be compressed before sending over Internet to the web browser to decode.

PHP also has a directive which can be used to adjust the compression level. To set the compress level, use the following line in php.ini, with valid values between 1 and 9, where 1 is least compress and 9 is most compress. Default compression level is 6, which provides the best compression without degrading server performance.

zlib.output_compression_level = 6

Previously, PHP compression is achieved by entering <?php ob_start(“ob_gzhandler”); ?> code at the beginning of each PHP scripts. The method is not recommended as each and every scripts have to be changed. zlib enabling in php.ini will apply to all PHP scripts on the web server without exclusion.

If it’s impossible to modify php.ini file, or does not have control over php.ini especially on a shared hosting, the PHP GZIP compression can also be setup via .htaccess file, typically located on the root of the website. To enable PHP GZIP compression via Zlib, just add the following line to the .htaccess file. Note that each website has to be changed individually.

php_flag zlib.output_compression on

The disadvantage of enabling GZIP compression via PHP is that only web pages generated by PHP scripts will be compressed by GZIP encoding. All external CSS or JavaScript files will not be compressed. For the ability to enable GZIP compression on all file types, uses mod_deflate or mod_gzip on HTTPD web server instead.

Do check and verify that GZIP compression is running properly.

Setting or Changing MYSQL Root Password

2 comments

Setting/changing MYSQL root Password
Setting up mysql database password is one of the important tasks which a webmaster should take care of. If you have never set a root password for MySQL, then
server does not require a password at all for connecting as root and if you have already set password for your database and for some reason if you want to change it then you can do so using following commands.
To setup root password for
MySQL databases for first time you need to login to your server as root and will have to use mysqladmin command at shell prompt as follows:

$ mysqladmin -u root password “mysql_password“


However, if you want to change/update your root password, then you will have to use following command



$ mysqladmin -u root -p oldpassword newpassword


after you fire above command you will have to provide password for your MySQL database.

How to add a range of IPs on a BSD box.

1 comments

FreeBSD is a popular free Unix like open source operating system that is based on the Berkeley Software Distribution (BSD) version of the Unix operating system. FreeBSD runs only on the Intel PC platform (i386 and higher) having atleast Pentium processor and also on amd64, Alpha/AXP, IA-64, PC-98 and UltraSPARC processors. You can consider FreeBSD as an alternative to Linux which will run Linux applications. Its said that its fast, stable, and is appropriate for Internet server or as a file server. FreeBSD supports all major X Window desktops, such as KDE and GNOME.



If you want to add Dedicated IPs on server having FreeBSD you need to follow following instructions.
First login to your FreeBSD server as a ‘non-root’ user. You should have an account in the ‘
wheel’ group. Once you logged in your server just run the following commands to switch users to ‘root’

su -
Password:
server#


you will get command prompt as ‘#’ which indicates that you are operating server as ‘root’ user. Now run following commands as root :
ee /etc/rc.conf

now for example, if we want to add 4 IPs for your server [ 192.168.1.3 - 192.168.1.6 ] you need to implement following :
Code:
ifconfig_fxp0=”inet 192.168.1.2 netmask 255.255.255.248?
ifconfig_fxp0_alias0=”inet 192.168.1.3 netmask 255.255.255.255?
ifconfig_fxp0_alias1=”inet 192.168.1.4 netmask 255.255.255.255?
ifconfig_fxp0_alias2=”inet 192.168.1.5 netmask 255.255.255.255?
ifconfig_fxp0_alias3=”inet 192.168.1.6 netmask 255.255.255.255?

Note that changes to the _aliasNN and also the netmask changes to 255.255.255.255 from 255.255.255.248. The IP’s will not work unless you use a 255.255.255.255 netmask for the alias IP’s.



Once you added the entries to your file you need to press ‘ESC’ and have to save this file. You need to reboot the server so that all new IP’s would get bounded with your server and you can use them.
You have other option too, you can also use
ifconfig command for adding IP’s on your server, in this case you don’t have to reboot your server. You can also add extra Dedicated IPs if you have WHM/cPanel control panel with your server. just login to your WHM account and add new Dedicated IP using WHM >> Add a new IP.

Installing SSL on server using WHM

0 comments
Almost all webmaster try to have SSL certificate on their ecommerce sites so that all transactions can be done securely. Domain which need to have SSL certificate should be hosted on dedicated IP where you can install SSL certificate for it. You can order SSL certificate from any provider and can install it for your domain. Once you have generated or received an SSL certificate, you can install the certificate using WebHost Manager. You need to have both the certificate and key files to install the certificate. Following steps would be helpful for you to install SSL certificate.
*) Login to WHM.
*) Click on Install an SSL Certificate and Setup the Domain under the SSL/TLS menu.
*) Enter the domain, user name, and IP address for the certificate in the Domain, User, and IP Address fields.
*) Click on the Fetch button to paste the .key and .crt files for the domain into the fields, if they are currently on your server. Otherwise, copy and paste the .key and .crt files into the available display areas.
*) Paste the ca bundle for the certificate in the bottom display area
*)Click on the Submit button.
that’s all you have successfully installed an SSL certificate for req

How to trap cPanel ( WHM ) Password Modification

0 comments

If your account is hosted on Linux hosting server then most webhosting service provider will offer you WHM/cPanel as hosting control panel depending on hosting package you choose. WHM/cpanel offer you large number of features using which you can manage your hosting account or website very easily. you can set/reset password of cpanel, can manage email accounts, hosting accounts, can easily disk quota, create FTP accounts, setup CMS etc….. Most important feature you have with these control panels is that you can change password of cpanel using cpanel aswell as WHM. You may have to change reset your control panel password for some security reason, thus this feature is very important for all webmasters.


If you want to know the password which have changed password of cpanel then you need to create a module in /usr/local/Cpanel/ChangePassword/. This will run as root when password is changed in WHM or cPanel.



Module features :
You can access following variables using above module :
- user (string) - Account Username
- newpass (string) - Account Password
- message (string)*** - Password Change Status Message
- rawout (string)*** - Password Change output
- service_ref (string)*** - Password Change Service

Thus in order to access above module you will have to do the following :



#!/usr/bin/perl
package Cpanel::ChangePassword::Sendtobilling;
use strict;



my %OPTS = @_;
my $user = $OPTS{’user’};
my $newpass = $OPTS{’newpass’};
#Add function to create object and password send

Username / Password can then be send to remote location thus you can retrieve password which have tried to change password of cpanel.

Unblock IP using CSF firewall - VPS server

0 comments
Following steps would help you to Unblock IP address you have blocked through CSF firewall. First of all you need to login to your VPS server using SSH access, then need to access APF firewall located under /etc/csf
you just need to edit csf.deny using vi csf.deny you need to remove IP address which you want to unblock from this file. Once you have edited above file you need to restart Firewall. For restarting Firewall you can use csf –r


Secure backup server

0 comments
Backups plays an important role when your server crash and you lost all your data, you can restore all your webfiles and can get your site up and running through your offsite backupaccount. Usually all webhosting service provider will offer you backup space on their remote server where you can upload backup copies of your webfiles, databases. If  you are connecting your server backup using some custom software or script then there can be a risk for using such custom applications as if your local machine gets compromised then hacker can easily login to your remote backup space and can delete all your data through this custom software. Thus its always recommended to go with a host who don’t use any such custom application for allowing users to login to your backup space rather go with a webhost who would initiates data transfer from their remote backup servers (using scp scripts or RSYNC over SSH) – thus your server doesn’t have a direct access to backup data directory. This will avoid any backup data loss as if you are using any custom application software for connecting to your backup server and your local machine gets hacked then hacker can easily login to your remote backup server and can delete all data from your server. Its better to check with your webhost about what kind of connection do they offer you for connecting with your remote server. Don’t go with any host who is offering you some script or software for getting