Total Pageviews

Saturday, December 26, 2009

Tuesday, May 12, 2009

Methods to reduce server load

1 )netstat -plan | grep :80 | awk '{print $5}' | cut -d: -f 1 | sort | uniq -c | sort -n

2) netstat -plan | grep :25 | awk '{print $5}' | cut -d: -f 1 | sort | uniq -c | sort -n

3) pstree -paul

4) cd /tmp

5) rm -f dos-* sess_* .spamassassin*

6) find . -user nobody -exec rm -f '{}' \;

7) ps -C exim -fH ewww

8) ps -C exim -fH eww |grep home

9) netstat -ntu | grep ':' | awk '{print $5}' | awk '{sub("::ffff:","");print}' | cut -f1 -d ':' | sort | uniq -c | sort -n

10) mysqladmin proc |grep Sleep |awk {'print $4'}|cut -d_ -f 1|sort|uniq -c|sort -nk 1

11) ps -C exim -fH ewww

12) for i in `ipcs -s | awk '{print $2}'`; do (ipcrm -s $i); done

13) for i in `mysqladmin proc |grep Sleep |cut -d " " -f 2`; do mysqladmin kill $i; done

14) exim -bp |grep "*** frozen ***" |awk '{print $3}' |xargs exim -Mrm

15) exiqgrep -z -i | xargs exim -Mrm;exiqgrep -o 432000 -i | xargs exim -Mrm

Monday, April 6, 2009

Cpanel Backend files!

Apache
=======
/usr/local/apache
+ bin- apache binaries are stored here - httpd, apachectl, apxs
+ conf - configuration files - httpd.conf
+ cgi-bin
+ domlogs - domain log files are stored here
+ htdocs
+ include - header files
+ libexec - shared object (.so) files are stored here - libphp4.so,mod_rewrite.so
+ logs - apache logs - access_log, error_log, suexec_log
+ man - apache manual pages
+ proxy -
+ icons -

Init Script :/etc/rc.d/init.d/httpd - apache start script
Cpanel script to restart apache - /scripts/restartsrv_httpd

Exim
=====
Conf : /etc/exim.conf - exim main configuration file
/etc/localdomains - list of domains allowed to relay mail
Log : /var/log/exim_mainlog - incoming/outgoing mails are logged here
/var/log/exim_rejectlog - exim rejected mails are reported here
/exim errors are logged here
Mail queue: /var/spool/exim/input
Cpanel script to restart exim - /scripts/restartsrv_exim
Email forwarders and catchall address file - /etc/valiases/domainname.com
Email filters file - /etc/vfilters/domainname.com
POP user authentication file - /home/username/etc/domainname/passwd
catchall inbox - /home/username/mail/inbox
POP user inbox - /home/username/mail/domainname/popusername/inbox
POP user spambox - /home/username/mail/domainname/popusername/spam
Program : /usr/sbin/exim (suid - -rwsr-xr-x 1 root root )
Init Script: /etc/rc.d/init.d/exim

ProFTPD
========
Program :/usr/sbin/proftpd
Init Script :/etc/rc.d/init.d/proftpd
Conf: /etc/proftpd.conf
Log: /var/log/messages, /var/log/xferlog
FTP accounts file - /etc/proftpd/username - all ftp accounts for the domain are listed here

Pure-FTPD
=========
Program : /usr/sbin/pure-ftpd
Init Script :/etc/rc.d/init.d/pure-ftpd
Conf: /etc/pure-ftpd.conf
Anonymous ftp document root - /etc/pure-ftpd/ip-address

Frontpage Extensions
=================
Program - (Install): /usr/local/frontpage/version5.0/bin/owsadm.exe
Uninstall and then install for re-installations
FP files are found as _vti-bin, _vti-pvt, _vti-cnf, vti-log inside the public_html

Mysql
=======
Program : /usr/bin/mysql
Init Script : /etc/rc.d/init.d/mysql
Conf : /etc/my.cnf, /root/.my.cnf
Data directory - /var/lib/mysql - Where all databases are stored.
Database naming convention - username_dbname (eg: john_sales)
Permissions on databases - drwx 2 mysql mysql
Socket file - /var/lib/mysql/mysql.sock, /tmp/ mysql.sock

SSHD
======
Program :/usr/local/sbin/sshd
Init Script :/etc/rc.d/init.d/sshd
/etc/ssh/sshd_config
Log: /var/log/messages

Perl
====
Program :/usr/bin/perl
Directory :/usr/lib/perl5/5.6.1/

PHP
====

Program :/usr/local/bin/php, /usr/bin/php
ini file: /usr/local/lib/php.ini - apache must be restarted after any change to this file
php can be recomplied using /scripts/easyapache

Named(BIND)
============
Program: /usr/sbin/named
Init Script: /etc/rc.d/init.d/named
/etc/named.conf
db records:/var/named/
/var/log/messages

--------------------------------------------------------------------------------------------------------------------------------------

Cpanel installation directory structure
=============================
/usr/local/cpanel
+ 3rdparty/ - tools like fantastico, mailman files are located here
+ addons/ - AdvancedGuestBook, phpBB etc
+ base/ - phpmyadmin, squirrelmail, skins, webmail etc
+ bin/ - cpanel binaries
+ cgi-sys/ - cgi files like cgiemail, formmail.cgi, formmail.pl etc
+ logs/ - cpanel access log and error log
+ whostmgr/ - whm related files

WHM related files
===============
/var/cpanel - whm files
+ bandwidth/ - rrd files of domains
+ username.accts - reseller accounts are listed in this files
+ packages - hosting packages are listed here
+ root.accts - root owned domains are listed here
+ suspended - suspended accounts are listed here
+ users/ - cpanel user file - theme, bwlimit, addon, parked, sub-domains all are listed in this files
+ zonetemplates/ - dns zone template files are taken from here

Common CPanel scripts
===================
cpanel/whm Scripts are located in /scripts/
+ addns - add a dns zone
+ addfpmail - Add frontpage mail extensions to all domains without them
+ addfpmail2 -Add frontpage mail extensions to all domains without them
+ addnetmaskips - Add the netmask 255.255.255.0 to all IPs that have no netmask
+ addnobodygrp - Adds the gorup nobody and activates security
+ addpop - add a pop account
+ addservlets - Add JSP support to an account (requires tomcat)
+ addstatus - (Internal use never called by user)
+ adduser - Add a user to the system
+ bandwidth - (OLD)
+ betaexim - Installs the latest version of exim
+ biglogcheck - looks for logs nearing 2 gigabytes in size
+ bsdcryptoinstall - Installs crypto on FreeBSD
+ bsdldconfig - Configures the proper lib directories in FreeBSD
+ bsdpkgpingtest - Tests the connection speed for downloading FreeBSD packages
+ buildbsdexpect - Install expect on FreeBSD
+ builddomainaddr - (OLD)
+ buildeximconf - Rebuilds exim.conf
+ buildpostgrebsd-dev - Installs postgresql on FreeBSD.
+ chcpass - change cpanel passwords
+ easyapache - recompile/upgrade apache and/or php
+ exim4 - reinstall exim and fix permissions
+ fixcommonproblems - fixes most common problems
+ fixfrontpageperm - fixes permission issues with Front Page
+ fixmailman - fixes common mailman issues
+ fixnamed - fixes common named issues
+ fixndc - fixes rndc errors with named
+ fixquotas - fixes quota problems
+ fullhordereset - resets horde database to a fresh one - all previous user data are lost
+ initquotas - initializes quotas
+ installzendopt - installs zend optimizer
+ killacct - terminate an account - make sure you take a backup of the account first
+ mailperm - fixes permission problems with inboxes
+ park - to park a domain
+ pkgacct - used to backup an account
+ restartsrv - restart script for services
+ restorepkg - restores an account from a backup file ( pkgacct file)
+ runlogsnow - update logs of all users
+ runweblogs - update stats for a particular user
+ securetmp - secures /tmp partition with options nosuexec and nosuid
+ suspendacct - suspends an account
+ unsuspendacct - unsuspends a suspended account
+ upcp - updates cpanel to the latest version
+ updatenow - updates the cpanel scripts
+ updateuserdomains - updates userdomain entries
Important cpanel/whm files
====================
/etc/httpd/conf/httpd.conf - apache configuration file
/etc/exim.conf - mail server configuration file
/etc/named.conf - name server (named) configuration file
/etc/proftpd.conf - proftpd server configuration file
/etc/pure-ftpd.conf - pure-ftpd server configuration file
/etc/valiases/domainname - catchall and forwarders are set here
/etc/vfilters/domainname - email filters are set here
/etc/userdomains - all domains are listed here - addons, parked,subdomains along with their usernames
/etc/localdomains - exim related file - all domains should be listed here to be able to send mails
/var/cpanel/users/username - cpanel user file
/var/cpanel/cpanel.config - cpanel configuration file ( Tweak Settings )*
/etc/cpbackup-userskip.conf -
/etc/sysconfig/network - Networking Setup*
/etc/hosts -
/var/spool/exim -
/var/spool/cron -
/etc/resolv.conf - Networking Setup--> Resolver Configuration
/etc/nameserverips - Networking Setup--> Nameserver IPs ( FOr resellers to give their nameservers )
/var/cpanel/resellers - For addpkg, etc permissions for resellers.
/etc/chkserv.d - Main >> Service Configuration >> Service Manager *
/var/run/chkservd - Main >> Server Status >> Service Status *
/var/log/dcpumon - top log process
/root/cpanel3-skel - skel directory. Eg: public_ftp, public_html. (Account Functions-->Skeleton Directory )*
/etc/wwwacct.conf - account creation defaults file in WHM (Basic cPanel/WHM Setup)*
/etc/cpupdate.conf - Update Config *
/etc/cpbackup.conf - Configure Backup*
/etc/clamav.conf - clamav (antivirus configuration file )
/etc/my.cnf - mysql configuration file
/usr/local/Zend/etc/php.ini OR /usr/local/lib/php.ini - php configuration file
/etc/ips - ip addresses on the server (except the shared ip) (IP Functions-->Show IP Address Usage )*
/etc/ipaddrpool - ip addresses which are free
/etc/ips.dnsmaster - name server ips
/var/cpanel/Counters - To get the counter of each users.
/var/cpanel/bandwidth - To get bandwith usage of domain

Sunday, January 18, 2009

tmp showing 100% even after removing file!!!

root@server [/tmp]# lsof +aL1 /tmp | awk '{print $2}' | xargs kill -9

Number of connection to port 80 from different IP's

netstat -plan | grep :80 | awk '{print $5}' | cut -d: -f 1 | sort | uniq -c | sort -n

Exim commands

1) To delete mails in the mail queue older than a day
exiqgrep -o 86400 -i | xargs exim -Mrm

2)exim -bp|grep $name Will show the mail in queue for $name
exim -Mvh $MSGID View message header
exim -Mvb $MSGID View message body
exim -M $MSGID Force delivery of message
exim -v -M $MSGID View the transact of message

3)Force delivery of one message
exim -M email-id

4)Force another queue run
exim -qf

5)Force another queue run and attempt to flush the frozen message
exim -qff

6)View the log for the message
exim -Mvl messageID

7)View the body of the message
exim -Mvb messageID

8)View the header of the message
exim -Mvh messageID

8)Remove message without sending any error message
exim -Mrm messageID

9)Giveup and fail message to bounce the message to the Sender
exim -Mg messageID

10)How much mail in the queue?
exim -bpr | grep "<" | wc -l


11)How many Frozen mails in the queue
exim -bpr | grep frozen | wc -l


12)Deleteing Frozen Messages
exim -bpr | grep frozen | awk {'print $3'} | xargs exim -Mrm


13)To find out, how many messages are there in the mail queue:
exim -bpc

14)To check the mails in the queue:
exim -bp

15)To force exim update:
/scripts/eximup --force

Saturday, January 17, 2009

To check whether ASP is avaliabe in server

/usr/local/apache/bin/httpd -l |grep mod_mono

To change Maximum emails perhour for a domain

1) Check [root@server ~]#vi /var/cpanel/maxemailsperhour to increase the value

2)[root@server ~]# vi /var/cpanel/maxemails
# If you update this file you must run /scripts/build_maxemails_config
domain.com=500
site.net=1000

3) To check the change
[root@server ~]#cat /var/cpanel/maxemailsperdomain/domain.com
500

Php info page not showing changes??

1)Copy /usr/local/cpanel/cgi-sys/php5.cgi to /home/username/ public_html/cgi-bin

2)Add the below given script

root [/home/username/public_html/cgi-bin]# vi phpini.cgi
#!/bin/sh
export PHPRC=/home/username/public_html
exec /home/username/public_html/cgi-bin/php5.cgi

3)And added a php.ini in the location (/home/username/public_html)

4)In the .htaccess put the following.

AddHandler php-cgi .php
Action php-cgi /cgi-bin/phpini.cgi

5) Permission of phpini.cgi should be 755

Block IP using IP tables

iptables -A INPUT -s IP -j DROP
iptables -A OUTPUT -d IP -j DROP

Php Suexec

To check whether php suexec is enabled in the server

/usr/local/cpanel/bin/rebuild_phpconf --current

Script to change premission of files and folders

To change the permission of files to 644
find /home/$i/public_html -type f -exec chmod 644 '{}' \;

To change the permission of folders to 755
find /home/$i/public_html -type d -exec chmod 755 '{}' \;

Outlook Express

Steps to configure Outlook express

1) Go to the Tools menu and select Accounts.
2) In the Internet Accounts window, click the Add button and select the Mail option.
3) Enter your name as you would like it to appear on your email in Display name: field.
4) Click the Next button.
5) Fill in E-mail address.
6) Click the Next button.
7) For Incoming mail (POP3, IMAP, or HTTP) server put your e-mail server(mail.DOMAIN.COM)
8) Click the Next button.
9) Enter the Account name: (test@DOMAIN.COM)
10) Enter the Password which corresponds to this account.
11) Do NOT select Log on using Secure Password Authentication (SPA).
12) Click the Next button.
13) Click the Finish button.
14) In the Internet Accounts window, click the Mail tab, then double-click your account name, this will open the properties window.
15) In the Account Properties window, click the Servers tab.
16) Under Outgoing Mail Server, check next to My server requires authentication.
17) Click the Advanced tab, disable the option Leave a copy of message in the server.
18)Then click apply and then Ok.

Linux

Hi!!! :)