Thursday 14 July 2016

Awstats not working in Cpanel


If you are getting “There are no domains which have awstats stats to display” while checking the Awstats from your cPanel >> logs >> Awstats. You can refer the following steps to resolve this issue

Please check the following files :

/usr/local/cpanel/3rdparty/bin/awstats.pl
/usr/local/cpanel/base/awstats.pl

The first file, /usr/local/cpanel/3rdparty/bin/awstats.pl, should be 755 file permissions. The second file, /usr/local/cpanel/base/awstats.pl, should be a symlink to /usr/local/cpanel/3rdparty/bin/awstats.pl

If the permissions are correct we have to run the following script to solve this issue

/scripts/runweblogs cPanel_username

 

 

 

 

 

 

Monday 14 March 2016

Tmpwatch installation to clean cache files

yum -y install tmpwatch
crontab -e
0 */1 * * * /usr/sbin/tmpwatch -am 1 /tmp/nginx_client



Blocking xmlrpc attack via .htaccess

You can add the below code to your .htaccess file to block POST requests to xmlrpc.php file due to excessive brute force attacks :

ErrorDocument 403 default
<Files xmlrpc.php>
    <Limit POST>
        Order deny,allow
        Deny from all
    </Limit>
</files>

Shutdown command

 /sbin/shutdown -h now

Email address verifying

You can verify the email accounts if they are valid from the following links :

http://hellodns.net/index.php/home/emailVerifier
http://verify-email.org/

Find command

find . -name '.Trash' -exec du -sch {} \; | grep M | sort -n

R1 soft plugin installation in cpanel servers

Here are the steps to install R1 soft plugin in paper_latern theme on cpanel.

http://wiki.r1soft.com/display/ServerBackup/Set+up+cPanel+plugin

This link mainly focus on installing the plugin on X3 theme. For custom installation on paper_latern theme. We have to run this script :

/usr/local/cpanel/scripts/install_plugin  (path to plugin folder/r1soft-cpanel-plugin-2.0) --theme paper_lantern

path to plugin folder >> The place where we have downloaded the plugin archive and extracted it

For custom installation in x3 theme :

/usr/local/cpanel/scripts/install_plugin  (path to plugin folder/r1soft-cpanel-plugin-2.0) --theme x3

In my case I have downloaded and extracted the plugin to /backup/r1soft/ location so the command will be :

 /usr/local/cpanel/scripts/install_plugin /backup/r1soft/r1soft-cpanel-plugin-2.0 -theme paper_lantern
 /usr/local/cpanel/scripts/install_plugin /backup/r1soft/r1soft-cpanel-plugin-2.0 --theme x3


If you are getting a 404 error while accessing the plugin after the installation please copy the r1redirect.php file to the following location :

cp r1redirect.php /usr/local/cpanel/base/frontend/paper_lantern/

Saturday 30 January 2016

CLEARING DNS CACHE


https://documentation.cpanel.net/display/CKB/How+To+Clear+Your+DNS+Cache



Blocking robots and spiders from crawling your site 
  
To disallow the spiders and block all robots from visiting your site, add the following in your robots.txt

User-agent: *
Disallow: /


WORDPRESS UPDATES


Yes, it is 100% about keeping the CMS Core, Plugins & Themes up-to-date. There are many tools out there to help you with this. For WordPress there is Wordfence. It can scan your files and compare them to known good files and notify you if there is a mismatch: https://wordpress.org/plugins/wordfence/

You can also secure your site via your .htaccess file to prevent PHP being run from the uploads folder and also preventing the insertion of code through URL injection:

http://codex.wordpress.org/Hardening_WordPress
http://www.creativebloq.com/wordpress/protect-your-wordpress-site-htaccess-4122793

DATABASE CONNECTING METHODS


There are two different ways to connect to a MySQL database. Locally (from a script on the server to the server), and Remotely (from a remote computer, using Shell, ODBC, or Navicat)

Locally, the settings are:
Hostname: localhost
Username: username_dbuser
Password: dbpassword
db_name: username_dbname
db_table: dbname_table

Remotely, the settings are the same, but you must use yourdomain.com in place of 'localhost'. Also, your IP address must be whitelisted on our end in order to get through our firewall. You can whitelist your IP address inside the cPanel under "Remote mySQL".


INSTALLING JAVA PLUGIN IN KUBUNTU


apt-get install icedtea-plugin

IMAPSYNC INSTALL

http://www.linuxbrigade.com/migrate-mail-one-server-another-imapsync/

Custom php.ini in DSO php handler

https://forums.cpanel.net/threads/custom-php-ini-for-dso.381642/

DELIST IP ADDRESS FROM HOTMAIL

 
http://answers.microsoft.com/en-us/outlook_com/forum/oemail-osend/delist-ip-from-hotmail-block-list/ebed285e-84e7-4ff8-98f2-ff525c49333b

 

SFTP

The main cPanel user can only connect to the server via SFTP/SSH on  port 22. This is the most secure option, and recommended. Please note  that additional FTP users created via cPanel do not have SFTP/SSH  privileges.    
  
   In FTP client such as FileZilla you can connect  as :
  
   - enter as hostname "SFTP://yourdomain.com"

Using SFTP is the same as FTP, except your password and other data is encrypted as it is transmitted between your computer and your website. This means your password is never sent in the clear and cannot be intercepted by an attacker.



WEBSITE ANALYSER


https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwww.supereight.net&tab=desktop

SRV RECORDS

You can refer the following link to create SRV records for the domains :

https://support.office.com/en-au/article/Create-DNS-records-for-Office-365-at-any-DNS-hosting-provider-7b7b075d-79f9-4e37-8a9e-fb60c1d95166?ui=en-US&rs=en-AU&ad=AU

IMAP and POP3


IMAP allows you to read emails as they appear on the hosting server. Any changes you make (delete, reply, forward, move) are seen by anyone else who logs into webmail or IMAP. This is the perfect solution for multiple users who need to access the same email account. This is also perfect for anyone who needs to access one email account from multiple devices at the same or different times.

POP3 allows you to download copies of your email messages to your personal computer. Any changes you make will NOT be seen by anyone else who accesses the email account (because you are only making changes to local copies). The copies of the email messages on the server are normally unchanged, but it is very easy to unintentionally setup your POP3 access to delete those server copies whenever you download the emails. This is a perfect solution for a user who has very limited time to be online, but needs to spend lots of time reading emails. This is also a perfect solution for anyone who needs to archive permanent copies of their emails.

FTP FILE LIMIT


I have just encountered an issue in which the client has more than 2,000 files in a folder. but only 1,998 files display in his FTP client.

Solution : 

By default, Pure-FTPd only shows up to 2,000 files in each folder.

To display more than 2,000 files when your server uses Pure-FTPd, perform the following steps:
In the command line, use your preferred text editor to open the pure-ftpd.conf   file.

    Locate the line that contains the following text:
    
LimitRecursion 2000 8

Replace 2000 with the number of files that you wish to view in the folder.

Restart the pure-ftpd service


Tuesday 26 January 2016

ACCESSING WEBMAIL CLIENTS


As an alternative to going to webmail, you can utilize one of the three default webmail clients through direct URL. Enter one of the following URLs in your browser's address bar

Horde:

https://www.yourdomain.com:2096/horde/index.php

SquirrelMail:

https://www.yourdomain.com:2096/3rdparty/squirrelmail/index.php

RoundCube:

https://www.yourdomain.com:2096/3rdparty/roundcube/index.php

HOT LINK PROTECTION

Hotlinking is when other people are linking your pictures on their pages or other resources. For example, if they really like the picture you have at http://domainanme.com/wp-content/uploads/2014/07/christmas_nails_by.jpg they can post that URL location on their websites and other resources such as facebook, twitter, etc. If you get excessive hits on that image file that is likely what's taking up all of your bandwidth usage. You can easily enable hotlink protection to prevent this from the cPanel -> Hotlink protection icon.

DATABASE OPTIMIZATION


You can also optimize your databases via the following steps :

      Login to cPanel
      Click on the phpMyAdmin button in the Databases section.
      Select the database you want to optimize from the list in the left column, which  should take you to the "structure" tab for the database.
      Select the tables you wish to optimize by checking the check box in front of each one, or clicking on Select All if you want to optimize all of them. 
      On the drop down box that says "with selected..." select "Optimize Table."  This will optimize the table and take you to a new screen.

WORDPRESS INSTALL

To Install Wordpress using the Softaculous script installer:

1. Log in to your cPanel control panel.

2. Select 'Softaculous' from the 'Software / Services' section.

3. Find the section in Softaculous called 'Portals/CMS' and select 'Wordpress'. A Wordpress information page will load on the right portion of the screen.

4. An install option can be found in the top right hand of the Wordpress information page.

5. How to fill out the installation form:

SOFTWARE SETUP

A. Choose Protocol - This option allows you to choose the protocol that shows on the address bar of individual's browsers.

B. Choose Domain - This drop down menu includes all domain names and sub-domain names that are on the account. Choose from this drop down menu the domain name where you wish to install Wordpress

C. In Directory - This is the option to choose the directory where Wordpress will be installed. For example, to have Wordpress installed in a folder called 'dir', type dir in the text box. To have Wordpress installed only on the domain, leave the field blank.

D. Database Name - This option allows you to choose the name of the Wordpress database. Default content will be included in this, you may leave it as this content or rename it.

Password : Type in a password you will use to access your Wordpress Administrator Dashboard. This password is very important to remember. If you lose this password, you will have to reinstall Wordpress.

SITE SETTINGS

A. Site Name - This option allows you to type in the name of your site.

B. Site Description - This option is used to input a short description of your website.

DATABASE SETTINGS

A. Table Prefix - This option allows you to change the prefix of your table. This settings is for more advanced users and it is advisable to leave it as-is.

B. Import Sample Data - This option allows you to select whether or not Wordpress will be installed with sample data given by Wordpress.

ADMIN ACCOUNT

A. Admin Username - This is where the Wordpress administrative username is selected. Wordpress is managed through a separate control panel, this information will be used to access that control panel.

B. Admin Password - This is where the Wordpress password is selected. It is used in conjunction with the username above to access the Wordpress control panel.

C. Real Name - Input your real name here.

D. Admin E-mail - This address will be used should the Wordpress login information be lost.

E-mail installation details to (optional): Fill this box with the e-mail address where you would like detailed information regarding the installation sent.

After filling out all fields hit the "Install" button and Softaculous will automatically install Wordpress with the specifications provided.

MYSQL UPGRADATION 

Make sure you run all the following in a screen otherwise in case if you loose connection while upgrade process through a normal ssh session, there is possibility of breaking up things.

First and prime thing is to backup everything related to mysql prior to upgrade.

Backup /etc/my.cnf, /root/.my.cnf ,/usr/local/apache/conf/httpd.conf , libmysqlclient.so (might be in path /usr/lib64, depends on class) module , php.ini

Take all databases dumps and mysql directory backup to

After all backing up process.

1) Change mysql-version=5.1 to mysql-version=5.5 in file /var/cpanel/cpanel.config

2) Run /scripts/check_cpanel_rpms --fix

   OR

run the upcp itself /scripts/upcp --force
((before running upcp script make sure, you set CPANEL=stable in "/etc/cpupdate.conf". Importance of stable tier is, it is always provided with bug fixed cPanel version))

3) Run easyapache to recompile apache and especially php needs to be rebuilt with new mysql modules.

After successfull easyapache, you're done with mysql upgrade. Check websites randomly if there is any issue.



ERROR 1273 (HY000) at line 446: Unknown collation: 'utf8mb4_unicode_ci'

I was getting the above mentioned error while restoring a database from a mysql dump file. I followed the 19 th answer in the below URL and the restoration worked fine for me 

http://stackoverflow.com/questions/29916610/1273-unknown-collation-utf8mb4-unicode-ci-cpanel

Email Header

To get the email headers from various email clients you can use the following link :
 
https://www.spamcop.net/fom-serve/cache/19.html

Dovecot Imap [FAILED]


Stopping Dovecot Imap: [FAILED]
Starting Dovecot Imap: doveconf: Fatal: Error in configuration file /etc/dovecot/sni.conf line 19: ssl_ca: Can't open file /var/cpanel/ssl/installed/cabundles/AlphaSSL_example.cabundle: No such file or directory

Solution :

touch all files in sni.conf file via the following command :
grep "/var/cpanel/ssl" /etc/dovecot/sni.conf|cut -d"<" -f2|xargs touch

IMAP SYNC INSTALL

You can refer the following link to install and use IMAP 

http://www.linuxbrigade.com/migrate-mail-one-server-another-imapsync/

IMAP SYNC 


imapsync  --host1  remote server IP --user1  username@domain.com --password1 "passwd"  --host2  Our server IP  --user2  username@domain.com --password2 "passwd"