Saturday, October 30, 2010

Nginx installation

Nginx installation and configuration on Centos5

1.Installing Nginx and required modules

first we can install the most important packages for nginx

for my case i have downloaded the pcre,zlib,openssl packages to /opt/nginx-0.7.67 (Where nginx-0.7.67 is from untared nginx)
cd /opt/nginx-0.7.67
#wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.10.tar.gz
(pcre for regular expressions)
#tar -xvf pcre-8.10.tar.gz
#./configure
#make
#make install

#wget http://zlib.net/zlib-1.2.5.tar.gz
#tar -xvf zlib-1.2.5.tar.gz
#./configure
#make
#make install

#wget ftp://ftp.openssl.org/source/openssl-0.9.8o.tar.gz
#tar -xvf openssl-0.9.8o.tar.gz
#./config
#make
#make install

#cd /opt
#wget http://nginx.org/download/nginx-0.7.67.tar.gz
#tar -xvf nginx-0.7.67.tar.gz
#cd nginx-0.7.67

# ./configure --prefix=/etc/nginx --user=nginx --group=nginx --with-http_ssl_module --without-http_rewrite_module --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --with-pcre --with-pcre=/opt/nginx-0.7.67/pcre-8.10/ --with-openssl=/opt/nginx-0.7.67/openssl-0.9.8o/ --with-zlib=/opt/nginx-0.7.67/zlib-1.2.5/
# make
# make install

useradd -M -r --shell /sbin/nologin --home-dir /etc/nginx nginx

# /etc/rc.d/init.d/nginx restart
/etc/rc.d/init.d/nginx: line 67: /opt/nginx/sbin/nginx: No such file or directory

#vi /etc/rc.d/init.d/nginx

nginx="/etc/nginx/sbin/nginx"
prog=$(basename $nginx)

NGINX_CONF_FILE="/etc/nginx/conf/nginx.conf"

Next we have to install spawn-fcgi for loading php pages for your web site.
#cd /opt/nginx-0.7.67
#wget http://www.lighttpd.net/download/lighttpd-1.4.18.tar.bz2
#tar -xvjf lighttpd-1.4.18.tar.bz2
#cd lighttpd-1.4.18/
#./configure
#make
#sudo cp src/spawn-fcgi /usr/bin/spawn-fcgi
#cd ..
#rm -rf lighttpd-1.4.18/
#rm lighttpd-1.4.18.tar.bz2
#/usr/bin/spawn-fcgi -f /usr/bin/php-cgi -a 127.0.0.1 -p 9000 -P /var/run/ajeesh.pid

2. configuring site

mkdir -p /home/ajeesh/public_html/
mkdir /home/ajeesh/public_html/logs
chown -R nginx:nginx /home/ajeesh/public_html

mkdir /etc/nginx/conf/sites-available
mkdir /etc/nginx/conf/sites-enabled

open your nginx conf file and inserver include
include /etc/nginx/conf/sites-enabled/*; --> under your another virtual host using mix of IP-, name-, and port-based configuration on /etc/nginx/conf/nginx.conf

open vi /etc/nginx/conf/sites-available/ajeesh.com

server {
listen 81;
server_name www.ajeesh.com ajeesh.com;
access_log /home/ajeesh/public_html/logs/access.log;
error_log /home/ajeesh/public_html/logs/error.log;

location / {
root /home/ajeesh/public_html;
index index.html index.htm;
}

location ~ \.php$ {
include /etc/nginx/conf/fastcgi_params;
fastcgi_pass localhost:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/ajeesh/public_html/www.ajeesh.com/public_html$fastcgi_script_name;
}
}

# cd /etc/nginx/conf/sites-enabled
# ln -s /etc/nginx/conf/sites-available/ajeesh.com
# service nginx start

Friday, October 29, 2010

webmail blank page

Issue:-
While accessing web mail through cpanel , you will get a blank page for the webmail. There won't see any squirrel mail,Horde, option for you to choose

Fix:- Try to change the Theme or update the same theme once again will fix the issue.

Wednesday, October 27, 2010

Apache module

How to check loaded apache modules

[/]# httpd -t -D DUMP_MODULES

For example if you want to enable mod_deflate Module you can recompile your apache using easyapache(for cpanel servers) and click deflate option and recompile it

Tuesday, October 26, 2010

Exim Error

exim-465 failed @ Mon Oct xx xx:xx:xx 20xx. A restart was attempted automagically.
Service Check Method: [tcp connect]

Failure Reason: Timeout while trying to get data from service
******


Solution:

First please try
WHM > Service Configuration > Exim Configuration Editor > click the "Reset all Configs to Defaults" button

if not please try this.

# wget -O /scripts/buildeximconf \http://httpupdate.cpanel.net/autofixer/buildeximconf
# chmod 700 /scripts/buildeximconf
/scripts/buildeximconf
/scripts/restartsrv_exim

Saturday, October 23, 2010

allow ssh via authorized keys

First we have to check the following settings

on your server /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

PermitRootLogin yes
PasswordAuthentication yes

After that on your client computer you need to generate ssh public key using dsa or rsa

#ssh-keygen -t rsa

this key will automatically generate and store on your /home/user/.ssh/id_rsa.pub
copy the content and paste on your server /root/.ssh/authorized_keys

please note that your root permission should be correct

you can check your log file on location /var/log/auth.log

Friday, October 15, 2010

Ezeelogin

1. Ezeelogin Log Files

All webpanel errors for ezeelogin would be in the dir assuming the default installation.(Ezeelogin installed in /usr/local/apache/htdocs/)

EzeeloginWebpanel files
-------------------------------------
/usr/local/apache/htdocs/ezeelogin/


Ezeelogin Web panel system file and Error logs path
-----------------------------------------------
/usr/local/apache/ezeelogin/logs/


Ezeelogin shell error logs for any user would be
-----------------
/home//ezeelogin.log

eg:/home/ezadmin/ezeelogin.log

2. User delete failed

Error:-Trying to delete a user and get the following error:
User delete failed
Cannot delete user on this node: REMOTE HOST IDENTIFICATION HAS CHANGED! (Reset fingerprint to authorize the change)

* this customer migrate the installation to a new server

Solution:- Need to reset the fingerprint of your current node. For that click on the 'Reset this node fingerprint' button under Settings->Cluster-> 





And for a particular server side issue you can fix this .
Servers > list servers > edit > advance option > Reset finger print.

3.User add failed

User add failed
sh: /usr/local/ezeelogin/ezlcltool: Permission denied

This may due to customer has been enabled selinux. They can verify this by using the command
root@jjjjjjjjj~]# ls -lZ /usr/local/ezeelogin/ezlcltool

-rwxr-xr-x root root root:object_r:usr_t /usr/local/ezeelogin/ezlcltool

So Disabling selinux will fix the issue

4.Error waiting for connection Error waiting for connection Error waiting for connection SSH log file (/var/log/ezeelogin/input/ezadmin/root~server.xxxx.com~Tue_Apr_6_18:16:12_2010) creation failed: Permission denied SSH log file (/var/log/ezeelogin/input/ezadmin/root~domain.com~Tue_Apr_6_18:17:58_2010) creation failed: Permission denied SSH log file (/var/log/ezeelogin/input/ezadmin/root~anotherdomain.net~Tue_Apr_6_18:18:05_2010) creation failed: Permission denied

Solution:-
chown -R ezadmin:ezuser /var/log/ezeelogin/

5. Connected successfully Authentication methods: publickey,keyboard-interactive Authentication by ssh key failed! Authentication by ssh key failed (pub: /usr/local/etc/ezeelogin/id_key.pub, priv: /usr/local/etc/ezeelogin/id_key, pass: OqDRjj3yVpyez3m): Username/PublicKey combination invalid Authentication by password not supported! User: root Action: C Server_id: 0 New password cipher: UZEi9CFPg4OIY89TKsobBnrQeh0Zf2injCoDe6j/+COqM8WHjMxuZu4in4u/kt2Z+fw3mPNzr1OUYY6UwgctJJlYWJ3oZroAoFjR3r4TrFX7mQHu0ZLYyvmrksTCny95u0toVb+9y2kVS67UdadFLzanbLfanU2n3UOt6TQnuKtJLQhRLqGB+8WHp+YZFfgMEJi6EYM9QljH4F4QreXkeMAq0GzlswDOLDOtPAJIlMJf8KrYCoWJZt+ypmJW0Jw+gAQ4PFyeO1k6TA/CZavM9pfJ0L3oIRXFRxuA1pqXJ/S7HadFm/QB3bn+6I9oQinEp/9YOieNtHGcxRlp2j0Ceg== New password: redhat Current password: Connecting to [10.10.11.1:22], timeout: 30

error geting while adding server to ezeelogin

solution:
By adding ' PasswordAuthentication yes ' on ssh config file(/etc/ssh/sshd_conf).


6 
issue: Installing Ezeelogin... Fetching binaries package... Could not fetch binary package. Please contact support@ezeelogin.com

 This may be an issue with the unavailability of ezeelogin repository with the particular Operating System.

ezeelogin package is not available in the ezeelogin repository for your installation. So this time it is good to open a support ticket with ezeelogin and they will add the installation package with in 24hours time.
 
Meanwhile, you could try the installation with the latest available download from your client area and once they updated the package you may upgrade to the latest version( using the command sh ezeelogin_version.bin -- -update)

7.  Blank page
If Selinux is enabled,  ioncube loader will not be available for your ezeelogin installed location. You will get blank page. So you have to disable Selinux on your ezeelogin installed server.

8. 04-09-2013
GeoIP issue: Invalid database type GeoIP Country Edition,
Fix:
1. wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
2. gunzip GeoLiteCity.dat.gz
3. mkdir -p /usr/local/share/GeoIP/
4. mv GeoLiteCity.dat /usr/local/share/GeoIP/

Thursday, October 14, 2010

freeBSD

User add / delete in FreeBSD:-
Adding User

[root@fbsd ~]# adduser
Username: ajeesh
Full name: Ajeesh B Kannan
Uid (Leave empty for default):
Login group [ajeesh]:
Login group is ajeesh. Invite ajeesh into other groups? []: wheel
Login class [default]:
Shell (sh csh tcsh bash rbash nologin) [sh]: bash
Home directory [/home/ajeesh]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password:
Enter password again:
Lock out the account after creation? [no]:
Username : ajeesh
Password : *****
Full Name : Ajeesh B Kannan
Uid : 1005
Class :
Groups : ajeesh wheel
Home : /home/ajeesh
Home Mode :
Shell : /usr/local/bin/bash
Locked : no
OK? (yes/no): yes
adduser: INFO: Successfully added (ajeesh) to the user database.
Add another user? (yes/no): no
Goodbye!

Delete user:-
[root@fbsd ~]# rmuser
Please enter one or more usernames: jack
Matching password entry:

jack:*:1006:1006::0:0:jack T:/home/jack:/bin/sh

Is this the entry you wish to remove? y
Remove user's home directory (/home/jack)? y
Removing user (jack): processes(2) mailspool home passwd.

1. Screen Install

[root@fbsd ~]# cd /usr/ports/sysutils/screen
[root@fbsd ~]# make install clean

2. Bash Shell
#cd /usr/ports/shells/bash
#make install clean
To make bash as default shell
# chsh -s /usr/local/bin/bash root(or your required username)
To check whether bash is installed
#finger root(or your required username)

2. Installing and configuring PURE-FTP on Free BSD
cd /usr/ports
1. make search name=pure-ftp :- find out the port
2. # make config
3. # make install clean
4. # cd /usr/local/etc
5. # cp pure-ftpd.conf.sample pure-ftpd.conf
6. # chmod 644 pure-ftpd.conf
7. # ee pure-ftpd.conf

VerboseLog yes
PureDB /usr/local/etc/pureftpd.pdb
CreateHomeDir yes
8. # pure-pwconvert >> /usr/local/etc/pureftpd.passwd
9. # chmod 600 /usr/local/etc/pureftpd.passwd
10.# pure-pw mkdb
11.# pw useradd vftp -s /sbin/nologin -w no -d /usr/home/vftp? -c "Virtual FTP user" -m
12.# pure-pw useradd ajeesh -u vftp -g vftp -d /usr/home/vftp/ajeesh
13.# pure-pw mkdb
14.# /usr/local/etc/rc.d/pure-ftpd onestart

once you add pureftpd_enable="YES" on /etc/rc.conf you can restart pure-ftp
# /usr/local/etc/rc.d/pure-ftpd restart
# /usr/local/etc/rc.d/pure-ftpd status

Saturday, October 9, 2010

Clamd:unable to connect UNIX socket

Clamd: unable to connect to UNIX socket error
Exim error log:
2009-03-07 11:20:46 1LfzGv-00033h-9T malware acl condition: clamd: unable to connect to UNIX socket /var/clamd (No such file or directory)
2009-03-07 11:20:46 1LfzGv-00033h-9T H=(n55.bullet.mail.sp1.yahoo.com) [98.136.44.188] F= temporarily rejected after DATA

Solution:
1. Uninstall clamd from WHM
WHM-->Cpanel->>Plugins/Modules

2. Remove files
/etc/clamd.conf
/etc/freshclam.conf

3. Reinstall clamd

PHP Warning

Error:-
[22-Sep-2010 00:53:58] PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/local/lib/php/extensions/no-debug-non-zts-20090626/pdo_sqlite.so' -
/usr/local/lib/php/extensions/no-debug-non-zts-20090626/pdo_sqlite.so: undefined
symbol: sqlite3_libversion in Unknown on line 0

Or some your error log file for your domain size will increase with the above error more that 1GB

Solution :- comment out pdo_sqlite in php.ini (;) or

Recompile your Apache to 5.2.13 or 14 stable version

Greylisting

Error:-

2010-10-09 08:07:20 1P4SaL-0000NW-L1 == emailID R=dk_lookuphost T=dk_remote_smtp defer (-44): SMTP error from remote mail server after RCPT TO:: host Theirmailser [196.28.76.20]: 451 Temporary Policy Rejection - Please try later
2010-10-09 08:07:32 cwd=/var/spool/exim/msglog 3 args: exim -Mvl 1P4SaL-0000NW-L1
2010-10-09 08:08:36 cwd=/var/spool/exim/msglog 3 args: exim -Mvb 1P4SaL-0000NW-L1

Once we enabled Greylisting on our exim mail server it will not accept our first email and send the bounce message with "temporary failure report" with "==" symbol.
Why we are enabling greylisting on mail server: To avoid virus's and spam bots emails to servers. Virus and spam bots often don't bother to try again, if they fail to deliver a message on the first attempt.
All our exim default settings (/etc/exim.conf) retries every 15 minutes for 2 hours. Means once the mail delivery failed after 15minutes it will retry to send email again. On that time all greylisting servers will allow and delivered to particular consignee.
If you want to reset retry to every 5minutes for 2 hours we need to edit exim.conf(RETRY CONFIGURATION) section as
* * F,2h,5m; G,16h,1h,1.5; F,4d,8h
and restart exim

Friday, October 8, 2010

INNODB to MYISAM

If you need to transfer your database which is INNODB formate to another server which engine is MYISAM
suppose test.sql is your database
You can check whic Engine it is used by using the command
# head -100 test.sql --> there you can see innodb or MYISAM

Our requirement is to restore the database to MYISAM however our server is supporting MYISAM. So we need to edit /etc/my.cnf line #skip-innodb to skip-innodb

Then execute the following perl script to change all Innodb terms in test.sql to MyISAM
perl -p -i -e "s/Innodb/MyISAM/" test.sql

Then restore the database
In some cases, database may be created by executing the commands in the dump file (for example if .sql file contains create database databasename)
So inorder to restore the dump just execute
mysql < test.sql

Wednesday, October 6, 2010

Web Mail Errors

1. Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /usr/local/cpanel/base/3rdparty/squirrelmail/plugins/login_auth/functions.php on line 129

Solution :
Upgrade your capanel --> /scripts/upcp --force
Will fix the issue

Friday, October 1, 2010

park domain

While Creating a redirection for your park domain it is showing an ERROR as

Apache detected an error in the Rewrite config. ErrorDocument takes two arguments, Change responses for HTTP errors

Which is due to your .htaccess rewrite rule mistake. Once you correct that it will work ok for you.