Drug preguntas

How to run Cpanel backup process during server load.

Cpanel No Comments »

This is not advised as it will place tremendous load upon your server

With that said:

1. open /scripts/cpbackup in your favorite text editor.
2. find ’sub cpusystem’ (without the quotes)
3. Change the nested if/elsif/else block to resemble:

else {
        #if ( -e "$CPCONF{'root'}/bin/cpuwatch" ) {
        #   exec( "$CPCONF{'root'}/bin/cpuwatch", "$cpunum.0", @_ );
        #}
        #elsif ( -e "$CPCONF{'root'}/bin/logrunner" ) {
        #    exec( "$CPCONF{'root'}/bin/logrunner", "$cpunum.0", @_ );
        #}
        #else {
            exec(@_);
        #}
        exit 1;
    }

4. Save the file and exit the editor
5. execute /scripts/cpbackup –force

The code changes disable the use of the process load monitors (cpuwatch and logrunner).

cPanel: PhpMyAdmin socket error

Cpanel No Comments »

MySQL Socket Error in phpMyAdmin

While accessing phpMyAdmin, you may get the following error.

—————————————————————————————–
#2002 - The server is not responding (or the local MySQL server’s socket is not correctly configured)
—————————————————————————————–

This is due to the missing socket file in the location /tmp.

The socket path which is specified in the phpMyAdmin configuration file is /tmp/mysql.sock.

$ vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php
cfg['Server']['socket'] = ‘/tmp/mysql.sock’;

If mysql.sock is missing in /tmp, then create a link to the mysql.sock file in /var/lib/mysql.

$ ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

There is also another fix for this issue.

1. Open the phpMyadmin config file “config.inc.php”.
————————————————————-
vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php
————————————————————-

2.Locate the line:
—————————————————
$cfg['Servers'][$i]['host'] = ‘localhost’;
—————————————————

3.Replace ‘localhost’ with ‘127.0.0.1′ and save.
—————————————————
$cfg['Servers'][$i]['host'] = ‘127.0.0.1′;
—————————————————

This will also fix the issue.

How to scan using Clamav??

Cpanel No Comments »

Use this command

#clamscan filename

#clamscan *

Cpanel Introduction

Cpanel No Comments »

Cpanel Introduction
——————–

Cpanel Important directories.

/usr/local/cpanel
/var/cpanel
/scripts

/usr/local/cpanel
—————
cpsrvd
cpsrvd-ssl
cpkeyclt

/usr/local/cpanel/bin
——————-

*Houses only scripts and binaries which provide installation
and configuration of many cPanel managed services

Notable Contents:
eximstats
checkperlmodules

/usr/local/cpanel/logs
——————–

CPSRVD ——-access_log, error_log
CPANELLOGD—stats_log
CPKEYCLT——license_lo

/usr/local/cpanel/base
——————–

frontend——-x, x2,xmail,monsoon
webmail——-x, monsoon
neomail
horde
3rdparty——-squirrelmail, phpPgAdmin, phpMyAdmin

/usr/local/cpanel/etc
——————-

init ———–start | stop cpsrvd AND start | stop AND start | stop cppop
exim———-cf, perl
ftptemplates —proftpd
httptemplates –apache1–default, ssldefault
zonetemplates–simple, standard, standardvirtualftp

/usr/local/cpanel/3rdparty
———————–
bin——php, stunnel, analog, awstats, webalizer
etc——php.ini, ixed, ioncube

/var/cpanel
———-
Houses proprietary configuration data for cPanel, including:
? Primary cPanel configuration
? User configurations
? Reseller configurations
? Accounting, conversion, and update logs
? Bandwidth data
? Customized service templates

/var/cpanel
———-

cpanel.conf
resellers
accounting.log
features–packages–logs
updatelogs–bandwidth–zone templates
users—mainips

/var/cpanel/cpanel.config
———————–
? The primary cPanel configuration file
? Each variable within influences the way cPanel behaves
? Variables are line delimited, with variables separated by an equal sign
? If file does not exist, cpanel falls back to defaults

/var/cpanel/resellers
——————

Lists each reseller with a comma-delimited list of WHM
resources that reseller has access to.

/var/cpanel/accounting.log
————————
Contains a list of accounting functions performed through
WHM, including account removal and creation.

/var/cpanel/bandwidth
——————–
? Files contain a list of the bandwidth history for each account.
Each named after their respective user.
? History files are stored in human-readable format, while actual
bandwidth data are stored in round robin databases.

/var/cpanel/features
——————

? File name is inherited from the feature list name
? Contains a line delimited list of feature variables and a zero or
one value
? Variables control what cPanel resources are available to users

/var/cpanel/packages
——————-

? Contains a list of packages, named after the packages they represent
? If package belongs to reseller, file name is prefixed with reseller name
? Each of these values determines the values created in cPanel user file

/var/cpanel/users
—————-

? Contains a list of cPanel user configuration files, named after the user
they pertain to.
? Variables define account resources, themes, domains, etc.

Other notable /var/cpanel directories
——————————–

? LOGS
– This directory contains logs from account copies/transfers.
Training Seminar 2006
? UPDATELOGS
– Contains the output of each cPanel update executed on the server.
? MAINIPS
– Named after the respective reseller users they represent, each
contains only the IP address which should be used as that
resellersmain shared ip
? ZONETEMPLATES
– Contains customized DNS zone templates created inWHM

/scripts
——-

This directory houses a large number of scripts which serve
as building blocks for many cPanel/WHM features.
The scripts can be used to:
? Update cPanel, and many of the services of which it
manages
? Customize account creation routines
? Perform backups of cPanel accounts
? Install and update cPanel managed services

cPanel Services
————-

Services
? CPSRVD
? CHKSERVD
? CPANELLOGD
? CPBACKUP
? EXIMSTATS

cpsrvd
——

? cpsrvd is the ‘master’ process for cPanel.
? Handles and dispatches all requests made through the cPanel,
WHM, and Webmail interfaces.
? Logs to access_log and error_log

cpsrvd and stunnel relationship
—————————

CPSRVD–2082–>cpanel<–2083<–stunnel
CPSRVD–2086–>WHM<–2087<–stunnel
CPSRVD–2095–>Webmail<–2096<–stunnel

SSL Certificates
————-

? Default certificate and key are stored in /
usr/local/cpanel/etc/cpanel.pem
? User installed cert and cabundle are stored in:
– /usr/local/cpanel/etc/mycpanel.pem
– /usr/local/cpanel/etc/mycpanel.cabundle

cPanel Startup
————

? The following services are controlled by the cPanel
init script
– cpsrvd, both plain and secure
– cPanel POP Services
– cPanel Log Services
– Eximstats
– Chat Services
– Mailman
– Interchange

? Verify if ports are in use
– netstat -lnp | egrep ‘20(8|9)’

Troubleshooting Startup Issues(SSL)
——————————-

? If SSL services are not available
– execute /usr/local/cpanel/startstunnel
– check /usr/local/cpanel/3rdparty/bin/stunnel.log
? If cpsrvd is not available
– execute it directly `/usr/local/cpanel/cpsrvd`
– check /usr/local/cpanel/logs/error_log

Licensing
——–

? License requests are handled by /usr/local/cpanel/cpkeyclt
? Requests are transmitted to auth.cpanel.net over port 2089
? License requests are logged to license_log
? License key is stored at /usr/local/cpanel/cpanel.lisc

A valid license request:
root@server [~]# /
usr/local/cpanel/cpkeyclt
Updating Internal cPanel
Information…..Done
root@server [~]#

Troubleshooting License Issues
—————————

CHECKLIST:
? Verify if license is active for main server IP at http://verify.cpanel.net
? Check if server can establish connection to auth.cpanel.net over port 2089
? If the previous steps fail, check license_log for notable errors.
? If license is active, but refused with no notable errors, lodge support request.

root@server [~]# telnet auth.cpanel.net 2089
Trying 198.66.78.9…
Connected to auth.cpanel.net (198.66.78.9).
Escape character is ‘^]’.
200 cPanel License Service Version 12.0
root@server [~]#

cPanel Requests
————–

cPanel Requests
? Logins are authenticated against the system passwd and shadow files.
? Documents root is /usr/local/cpanel/base
? Theme is defined by RS variable in user’s cPanel configuration file.
? Resources are limited by the feature list of assigned to the given user.

WHM Requests
————-

WHM Requests
? Root password will authenticate any reseller user
? Document root is /usr/local/cpanel/whostmgr/docroot/
? Reseller resources are limited by Access Control List
– Defined in WHM > Resellers > Reseller Center > Edit
Privileges/Nameservers
– Privileges are stored in /var/cpanel/resellers

cPanel Services
————–

Services
? CPSRVD
? CHKSERVD
? CPANELLOGD
? CPBACKUP
? EXIMSTATS

Service Monitoring
—————-
? Located at /usr/local/cpanel/libexec/chkservd
? chkservd is a scalable connection and process based service monitoring
tool
? Provides monitoring of CPU, Memory, and Disk usage
? chkservd scans services once every eight minutes
– Logs to /var/log/chkservd.log
? Alerts are dispatched to server contact defined in Basic cPanel/WHM
Setup

chkservd Configuration
——————–

? Monitored services are determined by values stored in /
etc/chkserv.d/chkservd.conf.
– Syntax: servicename:0 for no monitoring, servicename:1 for
monitoring
? Actions, expected responses, and failure events are defined in
service configuration files stored in /etc/chkserv.d/{servicename}
? Status files are stored in /var/run/chkservd/{servicename}
– Plus (+) sign for active, Minus (-) sign for failed

cpanellogd
———-

? cpanellogd is responsible for parsing and updating bandwidth logs, and dispatching
statistics generators on each account, per their individual configurations.
? Configured through Statistics Software Configuration and Tweak Settings in WHM
? Statistics are compiled and stored for each account in /home/{username}/tmp, with
each respective statistics application being assigned it’s own individual subdirectory.

/home/{username}/tmp —-webalizer, analog, awstats, urchin

? Optional server-wide statistics configurations are stored in /
etc/stats.conf, while user-specific configurations may reside in /home/
{username}/tmp.
? Notable Variables in /etc/stats.conf:
– BLACKHOURS: Comma separated list of numeric values, which
specify hours that logs may not be parsed.
– VALIDUSERS:Users which are allowed to supply their own
combination of statistics generators. By default users are
restricted to the generators defined by the administrator.

Calling cpanellogd
—————-

? cpanellogd is started with the cPanel service, but can be executed
directly with:
– No Argument: Daemonize, and wait for a suitable time to scan
logs
– One Argument (username): Execute an immediate statistics run
for the specified user, and exit once completed.
? Two scripts are available to provide these functions as well:
– /scripts/runlogsnow - Execute a full log run immediately
– /scripts/runweblogs {username} - Execute a log run for a single
user

Bandwidth Statistics
—————–

? Bandwidth statistics are accumulated from a combination of the
following cPanel managed services:
– HTTP
– EXIM
– IMAP / POP
– FTP
? Bandwidth data is logged to /usr/local/apache/domlogs/*bytes_log
? Parsed bandwidth data is stored in /var/cpanel/bandwidth

COMMON ISSUES
? Bandwidth parsing is taking an exceedingly long time to complete
– First check the size of the logs being parsed. Excessively large
log files can and typically will take a long time to complete.
– Additionally, if RRDtool is not installed, bandwidth parsing
performance will drop signifigantly.
? RRDtool can be installed by executing `/scripts/rrdtoolinstall`

Log Processing
————-

? Statistics are parsed for each child domain of the given account.
? Will be influenced by variables in /var/cpanel/cpanel.config
– Skip statistics generator
? skip{generator_name}
– Logs will be retained or deleted based on
? keeplogs – keep logs at the end of the month.
? dumplogs – dump logs after parsing

Common cpanellogd Issues
————————

? Statistics are stalling, or are taking unreasonable amounts of
time.
– Usually indiates that the server load average is consistently
exceeding the defined load limit.
? Limit is defined as ‘extracpus’ in /var/cpanel/cpanel.config
– Restrictive BLACKHOUR definitions in WHM > Statistics Software
Configuration.
– All other issues should be present in /
usr/local/cpanel/logs/stats_log

cPanel Backups
————-

GENERAL INFORMATION
? Backup configuration is performed in WHM > Backup > Configure
Backup
? cPanel backups are performed by /scripts/cpbackup, which is
configured by default to execute at 1:00 AM in the root crontab.
? Backup archives are created using the /scripts/pkgacct utility, and
may be restored using /scripts/restorepkg respectfully.
? Uses CPU resource limits based upon extracpus definition in
cpanel.config

Backup Configuration
——————-

BACKUP INTERVALS
? Backup script can be configured to operate in daily, weekly, and monthly intervals.
? Each interval is given it’s own respective directory within the backup root.
? Backup intervals are executed when the current time minus the last modification time
of the interval directory is less than or equal to zero.

BACKUP METHODS
—————-
Three backup methods are available:
? Standard: This method entails archiving the accounts, and storing
them at the specified path/mount point. This is the default method
used by the backup script.
? Incremental: This method uses rsync to incrementally backup user
data. This option will only operate locally, storing the data at the
specified path/mount point.
? Remote: This method transmits account archives to a specified ftp
server. Remote backups are typically more time consuming, and
more error prone when transmitting large accounts.

Common Backup Issues
——————–

? Backup intervals are not executed when expected.
– Modification times are incorrect or not functional
– System time is incorrect.
– Backups have not been defined to run on that day.
? Backups stall, or take an exceedingly long time to complete.
– Verify that the transmission rate to remote server is suitable
– Verify that server load average has not exceeded defined
resource limit.

? Can’t call method “login” on an undefined value
This indicates the host or passive setting is not properly
defined for remote backups.
? Unable to login to remote FTP server.
This indicates that either the username and password
were not specified, or are incorrect in the backup configuration.
? Can’t call method “prepare” on an undefined value
The password stored for the root mysql user in /root/.my.cnf is
incorrect. Reset or correct this password, and re-execute the backup
script.

eximstats
———

? The eximstats daemon is responsible for harvesting bandwidth
information from exim transactions.
? Continually monitors the exim_mainlog, and stores information in the
eximstats database, including host and sender information, message
size, and transaction times.
? Is started with the cPanel service, but can be called directly at /
usr/local/cpanel/bin/eximstats

? Heavily mysql dependent
– data is stored in the ‘eximstats’ database.
? ‘eximstats’ mysql user password is stored in /var/cpanel/eximstatspass.
– password is generated by /usr/local/cpanel/bin/eximstatspass
? Database can be installed by running /
usr/local/cpanel/bin/updateeximstats

cPanel Maintenance
—————–
? Update configuration
? Update scripts
? Applying updates

? By default, cPanel applies nightly updates at 2:13AM in the root crontab.
? /scripts/upcp dispatches these updates, using the following key
components:
– /scripts/updatenow - synchronize /scripts directory
– /scripts/sysup - updates cPanel managed rpms
– /scripts/rpmup - all other system updates
? Updates are logged to timestamped files in /var/cpanel/updatelogs
? Update configuration is stored in /etc/cpupdate.conf.

/etc/cpupdate.conf
—————–

? The following variables are available in cpupdate.conf:
– CPANEL = [ manual- ] stable | release | current | edge
This variable controls which update branch is used for
cPanel updates, and controls whether the updates are applied
manually or automatically (Default value: release)
– SYSUP = never (all other values are assumed true)
– RPMUP = never (all other values are assumed true)

CPANEL=current
RPMUP=daily
SYSUP=daily

? cPanel updates can be called outside of the regularly scheduled cron
time simply by executing /scripts/upcp.
? If cPanel components are missing or corrupted that were not replaced
with the regular cPanel update, they can be replaced by executing /
scripts/upcp –force

Components of upcp
——————

? /scripts/cpanelsync
? /scripts/updatenow
? /scripts/sysup
? /scripts/rpmup

/scripts/cpanelsync
—————–
? /scripts/cpanelsync is called upon by /scripts/updatenow and /
scripts/upcp
? Provides md5sum based synchronization with update servers
? md5sum table is stored in /destination_directory/.cpanelsync
? Accepts three arguments host, remote path, local path :
/scripts/cpanelsync ‘httpupdate.cpanel.net’
‘/cpanelsync/RELEASE/scripts’ ‘/scripts’

/scripts/updatenow
—————–

Calls cpanelsync to update contents of scripts
directory, which then stores it’s md5sum table
at /scripts/.cpanelsync
? Should only be run from upcp, but can be
executed from command line when ‘–fromupcp’
is passed.
? Is the first update script called upon from /scripts/upcp

UPCP–>updatenow–>FTPUP–>EXIMUP–>MYSQLUP–>BANDMINUP–>COURIERUP–>RPMUP

RPMUP
——–

? Calls the underlying package manager to apply system package
updates
? The package manager which is used is determined by the presence
of:
– /var/cpanel/useup2date (Redhat)
– /var/cpanel/useyum (CentOS,Fedora)
– /var/cpanel/useapt (Debian)
– /var/cpanel/useswup (Trustix)
– /var/cpanel/userug (SuSE)

cPanel Updates
—————-

? After updatenow, sysup, and rpmup complete, cpanelsync is used to
complete the cPanel updates based on md5sum table stored at /
usr/local/cpanel/.cpanelsync
? If any special configurations are required on server after updates,
they can be applied in /scripts/postupcp, which is executed if such a
file exists and is executable.
? Once updates complete, all cPanel services are restarted for changes
to take effect

cPanel Scripts
————–

? Account Management
? Package Management
? Service Update and Configuration
– MySQL
– Exim
– Named
– Apache
? cPanel and System

Account Management Scripts
——————————

? /scripts/wwwacct (account creation)
Accounts can be created via the command line using the following
syntax: /scripts/wwwacct exampledomain.com username password 0
x n
? /scripts/killacct (account termination)
Takes a single argument of the user to terminate.
? /scripts/suspendacct (account suspension)
Will suspend an account from accessing all cPanel managed
services.
? /scripts/unsuspendacct
Will reinstate any account suspended via suspendacct

? /scripts/addpop (Create pop account)
Handles creation of virtual mail accounts. Accepts either no
arguments, or two arguments consisting of the e-mail address and
password.
? /scripts/updateuserdomains
Updates the user:owner and user:domain tables stored in:
– /etc/userdomains
– /etc/trueuserdomains
– /etc/trueuserowners
– These tables are used to enumerate and keep track of accounts
and their owners.

Package Management
———————-

? /scripts/ensurerpm
Takes argument list of rpms, which are then passed to the
underlying package manager
? /scripts/ensurepkg
The equivalent of ensurerpm for FreeBSD. Updates specified
packages from ports.
? /scripts/realperlinstaller
Takes argument list of perl modules to install via CPAN
? Each of the aforementioned scripts can accept an argument of ‘–force’
to force package installations.

? /scripts/mysqlup
Can be called to apply MySQL updates independent of upcp
? /scripts/cleanupmysqlprivs
Will clean up the default MySQL privilege tables, by installing
a more restrictive privilege schema.
? /scripts/mysqlconnectioncheck
Will verify that mysql is accessible with password stored in /root/.my.cnf,
and force a reset with a random 16 character string if inaccessible.
? /scripts/restartsrv_mysql

? /scripts/eximup
Can be called to apply exim updates independent of upcp
? /scripts/buildeximconf
Will rebuild exim.conf, and merge local, distribution, and cPanel
configurations
? /scripts/restartsrv_exim

? /scripts/rebuildnamedconf
Rebuild named.conf based on existing zone files
? /scripts/restartsrv_bind

? /scripts/easyapache
Download, extract, and execute apache build script
? /scripts/rebuildhttpdconf
Rebuilds httpd.conf based on DNS entries found in each
cPanel user configuration
? /scripts/restartsrv_httpd

cPanel Scripts
————–

Useful Scripts – cPanel and System
? /scripts/restartsrv_{servicename}
The majority of cPanel managed service can be scripts named
appropriately.
? /scripts/makecpphp
Will rebuild the PHP interpreter used internally by cpsrvd
? /usr/local/cpanel/bin/checkperlmodules
Will scan for and install any Perl modules required by cPanel.
? /scripts/fullhordereset
Updates horde and resets the horde mysql user password
? /scripts/fixquotas
Will attempt to rebuild quota database per information stored in /
etc/quota.conf

How to install ClamAV in cpanel server??

Cpanel No Comments »

Go > WHM > Cpanel Install Plugin > Enable Clamav Connector

Cpanel showing SSL error??

Cpanel No Comments »

Login to WHM and under “Server Configuration” click on “Manage Service SSL Certificates” and choose the appropriate service that needs the SSL Certificate to be renewed and click on “Reset Certificate”.

Dreamweaver Database connection setup??

Cpanel No Comments »

To set up a MySQL connection from DreamWeaver to your  Web Hosting package:

1. Open Dreamweaver

2. Click on File then select New

3. Click on Dynamic Page in the left-hand frame then click on PHP (or any other type of dynamic page) in the right-hand frame

4. Click on Create (a new blank page will appear)

5. Click on Tools in the navigation menu then select Application

6. Click on the Database tab

7. If a Web site has already been created, skip options #1 and #2

8. Click on the Testing Server link in option #3

9. Verify or update the following settings:

n Server Model equal to PHP MySQL

n Access equal to FTP (this information is pertaining to how Dreamweaver will upload its pages)

n FTP Host equal to your domain name

n Host Directory equal to the directory where you would like your pages to be uploaded

n Login / Password equal to your Web Hosting FTP username / password

n URL prefix must be the complete URL (i.e. http://yourdomain.com/database/)

10. Click on the OK button

11. In the Database tab in the application window click on the + at the top of the window then select MySQL Connection

12. Verify or update the following settings:

n The connection name should be descriptive so that you will remember (e.g. My Web Site)

n MySQL Server Name equal to the IP address of your Network Solutions MySQL server.

n User Name / Password equal to your MySQL database username / password.

n Database equal to the name of your MySQL database.

13. Click on the Test button

14. If the test is successful click “OK” if the test in unsuccessful review the information provided in step #9 and 12

How to Configure Dreamweaver??

Cpanel No Comments »

Dreamweaver connects with a basic FTP program. In this guide, we will show you how to connect to the server and define some of the additional fields mentioned in the connection process and how they are used.

For the example I will be using Dreamweaver Ultradev 4; however, all versions of the program basically connect with the same interface so it doesn?t matter what version you are running.

In site menu you will want to choose new site, this will bring up the Site Definitions wizard:

Local Info Tab:

In this tab you will submit the information for your local machine so that it is able to calibrate links accurately when you post your website to our servers.

Site Name Field: In this field you will want to put a name for your website.

Local Root Folder: In this field you will put the path on your workstation to where you would like to store your website and any files related to it. This can be any folder on your computer but you will have to know how to get to it. Enter full path e.g. E:\webs\mynewwebsite\ or click on the folder icon to the right to navigate to your website’s directory.

HTTP Address: In this field you will need to put in your domain name - http://www.yourdomain.com, this enables Dreamweaver to calibrate any links that you have in your pages so that they work correctly both when you test the page on your workstation and on the web server.

Cache: The enable cache box allows your workstation to save any settings you use enabling the computer to work more quickly. Usually best left as enabled.

Remote Info Tab:

In this tab you will fill out the information for connecting to the web server. First you will want to change the access dropdown box from the default none to FTP.

FTP Host: In this field you will want to use the IP address that you were sent in the welcome email that came when your account was set up. You may also use the form ftp.yourdomain.com (substituting yourdomain.com for your own domain name).

Host Directory: you will need to put /public_html in this field, as this is where your content should be saved for viewing on the net.

Login: In this field you will use the user name that you were supplied in the welcome letter that you receive as confirmation that your site has been set up.

Password: In this field you will use the password that you were supplied in the welcome let that you receive as confirmation that your site has been set up

Use Passive FTP: Our servers do support Passive FTP Transfer. Although either setting should work, you may want to leave this setting unchecked.

Use Firewall: If you are using a firewall you will want this checked and will want to configure the firewall settings in the preferences for Dreamweaver. Try connecting with this setting unchecked if in doubt.

Check In/Out Area: These settings are for large groups working on the same project from remote locations as a sort of logging to tell who is working on what sections. Most users will not need this area and settings and can uncheck everything.

Bug in Mailman

Cpanel No Comments »

In cPanel >> Mailing Lists >> Modify

Getting the follwing error
*******************************************************************************************************
Bug in Mailman version 2.1.9.cp2

We’re sorry, we hit a bug!

Please inform the webmaster for this site of this problem. Printing of traceback and other system information has been explicitly inhibited, but the webmaster can find this information in the Mailman error logs.

***********************************************************************************************************
Errors seen in error log of mailman

vi /usr/local/cpanel/3rdparty/mailman/logs/error

**********************************************************************************************************
self._parsebody(root, fp, firstbodyline)
File “/usr/local/cpanel/3rdparty/mailman/pythonlib/email/Parser.py”, line 265, in _parsebody
msg = self.parse(fp)
File “/usr/local/cpanel/3rdparty/mailman/pythonlib/email/Parser.py”, line 64, in parse
self._parsebody(root, fp, firstbodyline)
File “/usr/local/cpanel/3rdparty/mailman/pythonlib/email/Parser.py”, line 206, in _parsebody
raise Errors.BoundaryError(
BoundaryError: No terminating boundary and no trailing empty line

*********************************************************************************************************

Resolution :

/scripts/fixmailman
/usr/local/cpanel/3rdparty/bin/check_db
/usr/local/cpanel/3rdparty/bin/check_perms
/scripts/reinstallmailman
chmod 02775 -R /usr/local/cpanel/3rdparty/mailman/

Also once the problem solved by changing the list language :)
Problem resolution if the above fix won’t work

The latest  Mailman have some bugs. It need Python version of 2.4.6 at least. But in your centos4/RHEL4 servers the python version is  2.4.3. So for fixing the mail man issue you need to upgrade the python without  breaking  Yum and other python modules.

It is little difficult for upgrading Python in cpanel servers. Because if you  upgrade python directly , the yum package manager will not  work. So  you need to reinstall all old rpms again.

Please proceed with the following for upgrading Python

1) Download and install python 2.4.6

# cd /usr/local/src/
# wget  http://www.python.org/ftp/python/2.4.6/Python-2.4.6.tgz
# tar -xvzf Python-2.4.6.tgz
# cd Python-2.4.6/
# ./configure –prefix=/usr/local/python.2.4.6/
# make
# make install

2) Configure cpanel for latest Python as follows

# grep python /var/cpanel/cpanel.config
#python=/usr/local/bin/python2.4
python=/usr/local/python.2.4.6/bin/python2.4
3) Now reinstall Mailman
# /scripts/reinstallmailman

This will fix your issue

Block Emails from a Particular domain??

Cpanel No Comments »

To block all emails sent from a specific domain:
-go to WHM/Service Configuration/Exim Configuration Editor and switch to Advanced mode
-at begin acl form put:

if $header_from: contains “@domain_name.com”
then
fail text “What message do you want.”
seen finish
endif”

How to change IP of all the domains in a shared server??

Cpanel No Comments »

If the main shared IP is null routed, another IP should be added to the server and it should be made as the main shared IP. For that we need to
1. Edit zone files to reflect the new IP for the domains hosted in the old main shared IP
2. Edit httpd.conf and replace old IP with new one

Editing the zone files
@@@@@@@@@@@@@@@@@@@@@@@

Step 1
======
Finding the list of zone files which are needed to be edited. It can be found out from the same servers /var/named

script to list zone files
————————–

##################################
#!/bin/bash
cd /var/named
ls -l|awk ‘{print $9}’ > zones
##################################

Now the file “zones” will contain all the zone file list.

Step 2
======

scp the file “zone” to the dns server (if your DNS server is not the same server) and put it in the /var/named folder

Step 3
======

Now we need to take each domain from the file /var/named/zones which we put earlier and replace old IP with new IP

Script for that
—————

###################################
#!/bin/bash
for i in `cat /var/named/zones`
do
perl -pi -e ’s/<old_ip_address>/<new_ip_address>/’ $i
done
####################################

then reload the named   BEWARE !!!!!! DONT RESTART ONLY RELOAD

/etc/init.d/named reload

Editing httpd.conf
@@@@@@@@@@@@@@@@@@

Now we have to make similar change on the servers httpd.conf so that all the entries of the <old IP> should be replaced with the <new IP>, that can be accomplished by a simple one liner perl script

#############################################################################

perl -pi -e ’s/<old_ip_address>/<new_ip_address>/’ /etc/httpd/conf/httpd.conf

#############################################################################S

After that restart apache

/etc/init.d/httpd restart

Now it will take a few hours for DNS propagation…….thats all the issue is fixed…..   ;)

How to Kill Zombie Process in server??

Cpanel No Comments »

This command will be useful to kill php zombie process.

ps -ef | grep mailnull | grep -v grep | awk ‘{print “kill -9″, $2}’ | sh

replace mailnull with particular proces name which has zombie

It workzz!!!!

How to start Mailman in cpanel?

Cpanel No Comments »

To start
/usr/local/cpanel/3rdparty/mailman/bin/mailmanctl start,

To stop
/usr/local/cpanel/3rdparty/mailman/bin/mailmanctl stop

Using Meta Tag to refresh and redirect a page

Cpanel No Comments »

Many a times we have a requirement where by we want to make a pager refresh by itself at a certain interval. We may also want to redirect the page to another page after a certain amount of time. I know we can do this with the help of Asp.Net Ajax Extension’s Timer control. But that can only be used when you are using Ajax in your page and more importantly should be used when you have requirement to update some small section of the page. For this requirement we can simply use a Meta tag in the Page header.

To refresh the page after a certain period of time, we can use the meat tag refresh. Here is how to use the tag (The tag should be added in the Head section of the page).

<meta http-equiv=”refresh” content=”300″>

The content attribute defines the time in second after which the page should refresh. So in the example the page would refresh after every 5 minutes.

To redirect the page to another page after certain time we can modify Meta tag like this.

<meta http-equiv=”refresh” content=”2;url=http://www.niyashussain.com”>

Here the page will be redirected to given URL after the time mentioned (2 seconds here) in the content (attribute) before URL here.

Cpanel-perl-upgarde-steps

Cpanel No Comments »

Cpanel-perl-upgarde-steps

To check what is the perl version on your system, use

perl -v

If you need to upgrade your perl installation

* Copy and paste this to a file and run the file using sh command.

wget http://layer1.cpanel.net/perl587installer.tar.gz
tar xfz perl587installer.tar.gz
cd perl587installer
./install
/scripts/upcp
/usr/local/cpanel/bin/checkperlmodules
perl -v

Cpanel Latest Perl Installer And Latest C Panel WHM Build

Cpanel No Comments »

* Cpanel Latest Perl installer and Latest cPanel/WHM Build

Please visit the url layer2.cpanel.net

How to prevent Iframe attack.

Cpanel No Comments »

Add these lines into .htaccess

RewriteEngine On

RewriteCond %{QUERY_STRING}    ^.*(;|<|>|’|”|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark).* [NC]
RewriteRule .* - [F]

Limit Emails/Day for a domain in Cpanel Server

Cpanel No Comments »

Itz easy to limit emails/per hour in cpanel server by go to WHM–>Tweak settings and find the option “emails per hour for a domain” and set the limit. “0″ means there is no limit.

How can we set the limit for a domain for each day as an exception?

For that, edit the file,

#vi /var/cpanel/maxemails

and add the line,

domain.com=500

Replace domain.com with the domain name you want to set the limit. Then run the command,

#/scripts/build_maxemails_config

It works….

Tips and Tricks to increase site speed

Cpanel No Comments »

When your equipment is not in tune with demand, your customers bail out and hit the road to a new service. In the world of Internet business, your equipment is your site. Every second is precious to your customer. What would be your reaction to a site that comes up so slow that you feel your time is wasted just trying to visit it? You would rather use your time to visit another site that loads faster. The same would be the reaction of your customer, when he sees that your site loads too slow. So, that’s the question:

Does your website load quickly enough?

Being in the support industry, I often see the following quotes:

My sites are slow…….
Site running slow…..
I was wondering, the site is running extremely slow! ….. etc etc

And once a customer asked me whether it’s possible to increase site speed using “http” headers.
Answer is Yes :)

Assuming that your site is hosted in a reasonably fast server and have a
good uptime, optimizing site codes is the most important factor in improving site speed. Other than that, another method is to use server files which are accessible by end users.

One such file is .htaccess. This file can be used to improve your site’s loading time greatly, if mod_expires and mod_headers are compiled with
Apache. Apart from this, there is one more simple method; gzip compression (using htaccess). Both are described in this article.

Obviously, these two techniques can also be added to “Htaccess Uses” list.
Defining htaccess

.htaccess, commonly known as “end user’s apache configuration file”, is used to customize configurations for a particular directory using the directives provided by apache.

This file is only used when users don’t have access to the main server configuration file. You can also give another name to htaccess file. If you want to call your “htaccess” file by another name, you can do it by using “AccessFileName” directive. For example:, if you wish to call .htaccess by the name niyas, it can be done by using the following directive.

AccessFileName .niyas

How Caching increases site speed?

Caching is a temporary storage of frequently accessed data closer to client browser, avoids round trips to original server and thereby saves time, reduces bandwidth consumption and server load. The basic idea behind caching is simple. Instead of wasting efforts by re-downloading a resource every time it is needed, keep a local copy, and reuse it for as long as it is still valid.
From Askapache

“A Web cache sits between one or more Web servers (also known as origin servers) and a client or many clients, and watches requests come by, saving copies of the responses - like HTML pages, images and files (collectively known as representations) - for itself. Then, if there is another request for the same URL, it can use the response that it has, instead of asking the origin server for it again.”

Freshness and validation are the two main concepts in web caching. Freshness refers whether a cached representation is in the same state, as, that resource on the origin server. Validation information is used by servers and caches to communicate when a representation has changed.

If server confirms that the cached object is still fresh, browser will “use” it, otherwise a fresh copy is served. In this way, servers “tell” cache how long the associated information/representation remains fresh.
Let’s see how cache works:

Caching is based on a set of rules. Most of these rules are determined by protocols and some of these rules are set by cache admin. Some of the common rules are:

* If the request is authoritative or genuine or secure, it won’t be cached.

* If the response header do not contain any validators (eg:- ETag or Last-Modified header) or freshness information, it will be considered uncacheable.

* A cached representation is deemed as fresh, if an expiry time or other age-controlling header set is defined, and is still within the fresh period.

* If the cached content is stale, the origin server will be asked to validate it.

Ways to Implement Caching:

Here are two awesome ways to implement caching on your website using Apache .htaccess file. Both methods are extremely simple to set up and will speed up your sites!
1. Using mod_expires

Requirements : mod_expires and mod_headers must be compiled with apache (static/dynamic).

Using mod_expires we can set life time for pages served or for contents in web pages. By this way, servers tell cache, how long the associated information/representation remains fresh. After this period, contents will be requested from origin. So it basically sets a time for web pages. This method is excellent for pages that change at known times or if they change very rarely. The only value valid in expire headers is the “Date” which is in GMT, not local time.

Eg: Expires: Sun, 25 Jun 2006 14:57:12 GMT

How can this be done using htaccess?

We can target files by their extensions

<ifmodule mod_expires.c>
<filesmatch “\.(jpg|gif|png|css|js)$”>
ExpiresActive on
ExpiresDefault “access plus 1 year”
</filesmatch>
</ifmodule>

or by their type

<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault “access plus 1 month”
ExpiresByType text/html “access plus 1 month 15 days 2 hours”
ExpiresByType image/gif “modification plus 1 month”
ExpiresByType image/png “modification plus 1 month”
ExpiresByType image/jpg “modification plus 1 month”
</IfModule>

Here “ExpiresDefault” defines the default expiry time for all files that are not specified separately using “ExpiresByType”.

You may also use formats “ExpiresDefault A300?, “Expires A300?, Expires M300? etc. Here the first two sets the expiry time to 300 seconds after access (A) and the last one sets expiry time to 300 seconds after modification.

Although this seems useful, there are some limitations in using “Expires” headers. First thing is that clocks on web server and cache must be synchronized. Also it’s easy to forget that we’ve set some content to expire at a particular time.

Due to these limitations HTTP 1.1 introduced a new type of header known as cache-control header.
2. Using Cache-control Headers

Here are some of common Cache-control Headers.

* max-age — Maximum amount of freshness time (in seconds).

* no-cache — When this is set, caches contact origin server for validation before releasing cached copy.

* public — Server responses are always cached even if it’s behind authentication.

* private — All or a part of server responses are intended for a particular use and must not be cached by a shared cache.

* no-store — Tells cache not to keep a copy of representation.

* must-revalidate — Caches must follow every freshness information given to them by the server.

Let’s see how this can be implemented using .htaccess

All text files, javascripts, pdf documents and style sheets are cached for 7days (604800 secs).

<FilesMatch “\.(js|css|pdf|txt)$”>
Header set Cache-Control “max-age=604800, public”
</FilesMatch>

All html files for two hours.

<FilesMatch “\.(html|htm)$”>
Header set Cache-Control “max-age=7200, public”
</FilesMatch>

No caching for php, perl and cgi scripts.

<FilesMatch “\.(php|cgi|pl)$”>
Header set Cache-Control “no-store, no-cache, must-revalidate, max-age=0″
</FilesMatch>

Also we can use “Expires” along with “cache-control”. Let’s modify the above.

<FilesMatch “\.(php|cgi|pl)$”>
ExpiresDefault A0
Header set Cache-Control “no-store, no-cache, must-revalidate, max-age=0″
</FilesMatch>

or

<FilesMatch “\.(php|cgi|pl)$”gt;
Header unset Cache-Control
Header unset Expires
</FilesMatch>

Suppose you want some of the files say mp3 and mp4 files to be cached for ever, use

<FilesMatch “\.(mp3|mp4)$”>
Header set Cache-Control “max-age=31536000, public”
</FilesMatch>

31536000 == 1 year (effectively infinite on Internet time).

So that’s all about caching and site speed. Now let’s see how we can speedup sites using compression.
Improving site-speed using Compression (mod_gzip)

Requirements : mod_gzip must be compiled with apache (static/dynamic).

Mod_gzip is an apache module which compresses the contents before sending it to the client browser. It uses same compression as gzip and no plugins or additional softwares are needed by the browser to take advantage of this. In this way less content is transferred which increases the download time and hence saves bandwidth.

Time taken to compress the contents, transfer to client and restore these at client end is faster than transferring original uncompressed files across the wire. Mod_gzip can be compiled with apache as static or dynamic module.

When client sends a request, apache determines whether it should use mod_gzip by checking whether “Accept-Encoding” HTTP request header has been sent by the client. If the request contains something like “Accept-encoding: gzip”, mod_gzip will compress all configured file types when they are served to clients. Here client announces to apache that it can understand files that have been encoded in “gzip” format. mod_gzip then compress the outgoing contents and include following response headers:

Content-Type: text/html
Content-Encoding: gzip

This means that content from the server is GZIP-encoded but after uncompressing, it should be treated as HTML files. This type of compression can be used for static files, dynamic pages such as those produced by Server-Side Includes (SSI). You can also use this type of compression for your Cascading Stylesheets(CSS).

Now let us see how gzip compression can be enabled via .htaccess:

The following code explicitly states the following:

* All text files (text/css, text/html etc.) and php files will be compressed.

* All PDF documents will be compressed.

* All javascript application files (that aren’t text/javascript) not to be compressed.

mod_gzip_on       Yes
mod_gzip_item_include         file       \.html$
mod_gzip_item_include         file       \.htm$
mod_gzip_item_include         file       \.shtml$
mod_gzip_item_include         mime       ^text/html.*

mod_gzip_item_include         file       \.css$
mod_gzip_item_include         mime       ^text/css.*
mod_gzip_item_include         file       \.php$

mod_gzip_item_include         file       \.pdf$
mod_gzip_item_include         mime       ^application/pdf.*

mod_gzip_item_exclude         file       \.js$
mod_gzip_item_exclude         mime    ^application/x-javascript.*

Other commonly used directives are:

mod_gzip_minimum_file_size — Minimum size ( in bytes ) of a file eligible for compression.
mod_gzip_maximum_file_size — Maximum size ( in bytes ) of a file eligible for compression.

mod_gzip is for Apache 1.3. If you’re using Apache 2.x, you’ll need to use mod_deflate which is not included here.
Pros and Cons:

Since it compresses the contents prior to transfer, lot of bandwidth is saved resulting in faster download times. Downside is that it will create additional load on server. Also some browsers still have trouble with compressed contents.
Conclusion

Kewl! If you’ve made it this far, you now know the easiest methods to optimize your site.

Generally speaking, caching and compression are two simple techniques which can be used to improve site’s performance. Expired header denotes a point in time after which the representation should be considered out of date (stale). In such cases Cache-Control header takes precedence.

By caching objects that change infrequently for longer periods, and caching frequently-updated content for shorter periods (or not at all) you can speed up perceived load times while maintaining fresh content.

Using Phusion Passenger (a.k.a mod_rails) On cPanel Server

Cpanel No Comments »

Phusion Passenger (mod_rails or mod_rack ) makes execution of Ruby web applications more easier on Apache webserver. It requires no maintenance from our part and minimal port management. It was designed keeping in mind performance, stability and security.

Here I am explaining more about deploying this module on Linux servers using cPanel as the control panel.

Currently in cPanel, by default, the Ruby On Rails(RoR) applications are using Mongrel webserver. By Phusion Passenger, we can use Apache itself for RoR applications, instead of redirecting the application to Mongrel.

Installation

We can install Phusion Passenger using different methods. An Easy way is to use gem to install Phusion Passenger in two simple steps. Make sure that RoR is already installed on your cPanel server using ‘/scripts/installruby‘.

Step 1: #gem install passenger
Step 2: #passenger-install-apache2-module

In the second step, while installing ‘passenger-install-apache2-module’, I ran into two errors. The errors and corresponding solutions are given below.

Error 1: Apache 2 development headers were not detected by the script.

Checking for required software...

 * GNU C++ compiler... found at /usr/bin/g++
 * Ruby development headers... found
 * OpenSSL support for Ruby... found
 * RubyGems... found
 * Rake... found at /usr/bin/rake
 * Apache 2... found at /usr/local/apache/bin/httpd
 * Apache 2 development headers... missing..(some error here)

Solution: Here the script is checking for apxs installation path. On a cPanel server, the default path is ‘/usr/local/apache/bin/apxs‘. But the script was looking for ‘/usr/sbin/apxs’. To solve this, I created a symbolic link from ‘/usr/sbin/apxs‘ to ‘/usr/local/apache/bin/apxs‘.

Error 2: Another error that came up was:

/usr/local/apache/include/apr_file_info.h:200: error: 'apr_ino_t' does not name a type ..."

Solution: There were two installation of apr on the server. One by default and one by cPanel. The passenger script was taking binary path from one installation and include files from other. I moved the default installation on the server to a backup folder and created a symbolic link from default installation’s include directory to apr include directory of cPanel. The command for this is given below:

#ln -s /usr/local/apache/include/ /usr/include/apr-1

Loading Modules

After completing the ‘passenger-install-apache2-module’ step successfully, add the corresponding Modules to Apache configuration file.

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-
2.0.2/ext/apache2/mod_passenger.so
   PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.2
   PassengerRuby /usr/bin/ruby

Save and restart Apache.

#/usr/local/cpanel/bin/apache_conf_distiller --update
#/usr/local/cpanel/bin/build_apache_conf
#/etc/init.d/httpd restart.

Deploying RoR application:

Suppose, we have a RoR application in “/home/username/testapp”. Follow the steps given below to redirect the main domain to this application.

Step 1: By default the Document root of this domain will be /home/username/public_html/. Create a symbolic link from /home/username/public_html/ to the RoR application’s public directory, /home/username/testapp/public/.

-bash-3.2# ln -s  /home/username/testapp/public/ /home/username/public_html

Step 2: Then add the following rule in the virtual host entry of the domain.

RailsBaseURI /

Note : If you want to redirect a subdirectory under public_html like http://domainname/rails to the RoR’s application, change the symbolic link accordingly and specify the rule in the domain’s virtualhost entry as:

RailsBaseURI /subdirectory_name

It is not recommended to edit the virtual host entry directly. You can add this rule in the include file mentioned in the virtual host entry of the domain.

Include "/usr/local/apache/conf/userdata/std/2/username/domain_name/*.conf"

By default these include files will be commented in the configuration file. We have to manually create directories corresponding to this include file.

Directories up-to /usr/local/apache/conf/ were already there in the server. I created new sub-directories from ‘userdata’ to ‘domain_name’. Under the directory /usr/local/apache/conf/userdata/std/2/username/domain_name/, you can create any file with .conf extension. I created the file rails.conf to add the “RailsBaseURI” rule.

-bash-3.2# ll /usr/local/apache/conf/userdata/std/2/username/domain_name/
total 4
-rw-r--r-- 1 root root 15 Jul 31 04:05 rails.conf

Step 3: After that, execute the below command,

#/scripts/ensure_vhost_includes --user=username  (Use cpanel username of that domain)

Step 4: You can restart the RoR application by restarting Apache or using the command,

#touch /path_to_application/tmp/restart.txt

In this case,

#touch /home//username/testapp/tmp/restart.txt

The domain will now work fine using this new mod_rails installation. :) Make sure that you are not starting or restarting this application from cPanel >> Ruby On Rails option. It will switch to Mongrel webserver.

You can check Apache error log file itself for errors.

Conclusion

Although cPanel is not using this module (mod_rails) with Easyapache script and in their Ruby Ob Rails interface. By following this method, we can use this module on a cPanel server with much ease.

Phusion Passenger conflicts with some Apache modules like mod_rewrite and mod_alias. They may be installed together with mod_passenger and used outside virtual hosts that contain a Rails application. Phusion Passenger recommend not to use their features inside virtual hosts that contain a Rails application. Rewrite rules are mainly used to accelerate caching of pages. Phusion Passenger supports page caching without mod_rewrite. So there is no need to worry about this.

Tips:

Firstly make sure you add the generated code to :

/usr/local/apache/conf/includes/pre_main_global.conf

and not

/etc/httpd/conf/httpd.conf

or otherwise cPanel will overwrite it when it does updates.

Another way or running the command to install the passenger Apache2 Module without creating a link is :

APXS2=/usr/local/apache/bin/apxs PATH=$PATH:/usr/local/apache/bin passenger-install-apache2-module

If  you are executing the application using any scripts in the scripts directory of rails application, make sure that rails/ruby is installed in the interpreter path defined in that file. You can see the shebang line as,

===================
#!/usr/bin/env ruby
===================

In this case, ruby should be installed in /usr/bin/ruby. Like this, check your ruby installation path.

Wordpress Themes by Natty WP. Web Hosting
Images by our golf tips desEXign.