Pages

Friday, September 20, 2013

cPremote version 6.6 is available now – Compatible with cPanel 11.36

An updated version of cpremote ,  6.6 is available now  for download. This  version is fully compatible with  cPanel version 11.36
Change Log:

        Removed the use of /var/cpanel/3rdparty/bin/php
        Added new  CPPHP support

Upgrade:
It will be automatically upgraded to the  new version. If you like to upgrade it manually, then simply run the cpremote installer in your server.

Add a wild card domain in danginx ( Directadmin Nginx )

By default  danginx won’t include the custom wild card domains. But you can create a vhost configuration as follows. Suppose if you need to create a wild card domain *.foo.com with user name “foo” and document root ” /home/foo/domains/foo.com/public_html and IP 10.0.0.10  ,  then

1)  Create a file name  /etc/danginx/foo.conf with the following content

Vhost configuration of   *foo.com
#################################################################
server {
access_log off;
error_log  logs/vhost-error_log warn;
listen [::]:80;
server_name  *.foo.com;
location ~* ^.+.(jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|iso|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mp3|ogv|ogg|flv|swf|mpeg|mpg|mpeg4|mp4|avi|wmv|js|css)$ {

Nginx And DDOS Protection

cPnginx and Danginx can use  to protect the HTTP DDOS as follows,
Edit the file   /etc/sysctl.conf  and increase the openfile limits. Add the following line,

fs.file-max = 700000

Edit  /etc/security/limits.conf  and add the following  lines,

nobody       soft    nofile  100000
nobody       hard    nofile  500000

Now apply the sysctl configuration using the following command .

# sysctl -p

Enable Cache in cPnginx Servers

You can enable cache in cPnginx. This will decrease the server load. But enabling cache will show the  website updates slowly only. To enable cache please do the following,

1) Modify the file /etc/cpnginx/vhost.conf as follows,
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_send_timeout   90;
proxy_read_timeout   90;
proxy_buffer_size    4k;
proxy_buffers     16 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_connect_timeout 30s;
proxy_cache my-cache;
proxy_cache_valid  200 302  60m;
proxy_cache_valid  404      1m;
proxy_cache_key “$scheme$host$request_uri”;

2) Edit nginx.conf as follows,

Nginx And HttpRealIpModule

This module is already  enabled by default in cPnginx version 6.0 or  higher . You may simply need to add the   module setting in nginx.conf as follows,

set_real_ip_from   $firewall_ip1;
set_real_ip_from   $firewall_ip2;
real_ip_header     X-Real-IP;

You  may also edit  /usr/local/apache/conf/mod_rpaf.conf with the following

RPAFheader X-Real-IP
RPAFheader X-Forwarded-For

These sttings are required for cloudflare clients.

That’s it !!

That’s it !!

See more at: http://datlinux.blogspot.com.es/

Wednesday, September 4, 2013

How to reset default SSH port for cPanel/WHM

How to change/reset default SSH port on your cPanel servers?

Did you forget SSH port and try to reset it via WHM, Use the following  SSH configuration settings on WHM.

Login to your WHM on a non secure port that is : 2086
For example : http://serverip:2086

Then browse the URL to reset the SSH configuration settings :

http://serverip:2086/scripts2/doautofixer?autofix=safesshrestart

After running the script, the default port 22 will reset on your cpanel SSH configuration. You can login SSH and reset it.

That’s it !!




How to Backup and Restore Individual cPanel Account via SSH

Backing up your hosting account is very necessary for your business to survive on Internet. Whether it is a small or large business, you must backup all of your data regularly at least once a week. cPanel provides some great ready made scripts which will help you make your tasks more easy. Commands such as pkgacct is basically used for backing up cpanel web hosting accounts and restorepkg for restoring cpanel accounts via the SSH or command line interface.

How to create backup of Individual cPanel Account via SSH?

Step 1: Log-in to the SSH as Root user.

Step 2: Enter the following command string on the command line interface:

    /scripts/pkgacct username

[Note: The account backup will be created in the current directory you are in.]

How to Restore the Individual cPanel Account via SSH?

Step 1: To restore the cPanel account backups, enter the following command

    /scripts/restorepkg username

[Note: In order to restore the data, you need to be in the directory where the backup file is stored.]

How to Reset MySQL root Password

To provide multi user  access to number of databases a relation database management system is been developed that runs on a server and called as MySQL. MySQL is developed under GNU General Public License and its source code is available under its defined terms. MySQL is a popular choice of database for use in web applications and it performs really well with cPanel hosting accounts to store data of any websites. And suppose if you have forget the MySQL root password and you are not able to access your mysql service then you need to reset the password of MySQL root user by using following steps which are as follows,

Steps to Reset MySQL root Password :

1)root@server [~]/etc/init.d/mysqld stop

2)Start to MySQL server without password:
root@server [~]mysqld_safe –skip-grant-tables &

3) root@server [~] mysql
After that you can get the mysql prompt then run the following command

4)mysql >use mysql;

5)mysql >update user set password=PASSWORD(“NEWPASSWORD”) where User=’root’;

6)mysql > quit

7)root@server [~]/etc/init.d/mysqld stoproot@server [~]/etc/init.d/mysqld start
Now you can access your mysql service by using
[root@server ~]#mysql -u root -p

How to ban or block an IP address from visiting my website?

You can make use of .htaccess files in order to block an IP address from accessing your website. A .htaccess is a kind of configuration file that can be used from things like setting password-protected directories, preventing the display of file extensions to, of course, restricting access based on IP.
To ban an IP address from accessing your website, create a .htaccess file within your root directory (usually public_html or www) and add the following configuration in the file:
order allow,deny
deny from 127.0.0.1
allow from all

How to Upgrade mod_pagespeed

Inorder to upgrade the mod_pagespeed module, you must first download the latest version and make use of the command “yum localinstall mod-pagespeed-*.rpm” for the purpose of installing http://code.google.com/speed/page-speed/download.html
Use the below commands to upgrade the package :
sudo yum update
sudo /etc/init.d/httpd restart

Simple PHP Script for RBL Checking

It’s useful for ISP’s and email service providers to run occasional RBL checks against their IPs to know when they are being blacklisted by populate CBL services. I’ve written a simple script that utilizes the DNSBL pear library to check against common blacklists, when given a list of IPs in a file.
First, you need to download or install the NET_DNSBL pear module. (Command: pear install NET_DNSBL)

<?php
require_once('Net/DNSBL.php');

$iplist = file("/path/to/iplist");
foreach ($iplist as $ip){
$dnsbl = new Net_DNSBL();
$dnsbl->setBlacklists(array(
'sbl-xbl.spamhaus.org',
'dnsbl.sorbs.net',
'bl.spamcop.net',
'dnsbl-1.uceprotect.net',
'dnsbl-2.uceprotect.net',
'dnsbl-3.uceprotect.net',
'isps.spamblocked.com',
'zen.spamhaus.org'
));

if ($dnsbl->isListed($ip)) {
echo "IP $ip is blacklisted!\n";
}
else {
echo "IP $ip not listed\n";
}
}

?>

This checks your IP's to a RBL listing so you can take appropriate action against abusers.