Thursday, February 19, 2009

How to configured Postfix

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
mail_owner = postfix
myhostname = domain.com
mydomain = domain.com
myorigin = domain.com
inet_interfaces = all
mydestination = hash:/etc/postfix/mydomains
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mail_spool_directory = /var/spool/mail
smtpd_banner = $myhostname ESMTP $mail_name
debug_peer_level = 2
debugger_command =
         PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
         xxgdb $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.2.10/samples
readme_directory = /usr/share/doc/postfix-2.2.10/README_FILES
virtual_alias_maps = hash:/etc/postfix/virtual
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtp_sasl_security_options = noplaintext
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
mailbox_size_limit = 0
message_size_limit = 2500000000
 

After configured main.cf create mydomains file write down bleow
vi mydomains
# mydomains - include a a list of aliases for your machine here, formated:
# example.com                   OK
# After change, run "postmap /etc/postfix/mydomains"
domain.com(domainname)           OK
localhost               OK
app1.lax.0336 (servername)            OK
 

/usr/sbin/postmap mydomains
 
After configured mydomains create virtual file
 vi virtual
# virtual - LHS is the incoming email address and the RHS is the local recipient
# or alias, like this:
# .com                  postmaster
#
# After change, run "postmap /etc/postfix/virtual"
# Catchalls go at the bottom.
admin@domain.com admin
postmaster@domain.com
 
/usr/sbin/postmap virtual
 
Stop all mail services & start postfix .
 
start service /etc/init.d/saslauthd start
 
 
For see How much connection
ps -ef|grep -c http
ps -ef|grep -c ftp
ps -ef|grep -c mysql
netstat -n | wc -l
Java Bridge configration
./configure --with-java=/usr/java/jdk1.5.0_13,/usr/java/jdk1.5.0_13/jre --with-php-config=/usr/local/shri/php/bin/php-config
Find large hits from which IP awk '{print $1}' /var/log/httpd/access filename| sort | uniq -c | sort -n | tail -20
select * from table name limit 1;
netstat -n | wc -l




Enable Memcache in Apache

<IfModule mod_mem_cache.c>
#cache everything that contains /images and /ImgNew in the URL
CacheEnable mem /images
CacheEnable mem /css
CacheEnable mem /js
#Utilize 2Gigs of memory
MCacheSize 2097152
#max number of items to hold in cache
MCacheMaxObjectCount 1024
MCacheMinObjectSize 1
#max file size in bytes a single cached file maybe
#set to 1 meg below
MCacheMaxObjectSize 1048576
#use least requsted removal algorithm
MCacheRemovalAlgorithm LRU
</IfModule>

Tuesday, February 10, 2009

How to configured Squid

How to configured Squid

 

Vi  Squid.conf

       http_port 8080

        icp_port 0

       acl QUERY urlpath_regex cgi-bin \?

       no_cache deny QUERY

       cache_mem 16 MB

       #cache_dir ufs /cache 200 16 256

       redirect_rewrites_host_header off

       #replacement_policy GDSF

      #acl localnet src 10.0.0.26/255.255.255.0

      acl localhost src 127.0.0.1/255.255.255.255

      acl Safe_ports port 80 443 210 119 70 21 1025-65535

      acl CONNECT method CONNECT

      acl all src 0.0.0.0/0.0.0.0

      http_access allow all

      http_access allow all

      http_access deny !Safe_ports

      http_access deny CONNECT

      #http_access deny all

      cache_mgr admin@openna.com

      visible_hostname pluto

      cache_effective_user squid

      cache_effective_group squid

      log_icp_queries off

      cachemgr_passwd my-secret-pass all

     buffered_logs on

 
 

Confiured VSFTP

VSFTPD  Setup

Install vsftpd.i386

cd /etc/vsftpd/

vi vsftpd.conf

anonymous_enable=NO

local_enable=YES

write_enable=YES

local_umask=022

dirmessage_enable=YES

xferlog_enable=YES

connect_from_port_20=YES

chown_uploads=YES

chown_username=vidal

xferlog_file=/var/log/vsftpd.log

xferlog_std_format=YES

idle_session_timeout=600

data_connection_timeout=120

ftpd_banner=welcome to TC ftp services.

chroot_list_enable=YES

chroot_list_file=/etc/vsftpd/chroot_list

pam_service_name=vsftpd

#nopriv_user=ftpgroup

#anon_upload_enable=YES

#anon_mkdir_write_enable=YES

#async_abor_enable=YES

#ascii_upload_enable=YES

#ascii_download_enable=YES

#deny_email_enable=YES

#banned_email_file=/etc/vsftpd.banned_emails

#ls_recurse_enable=YES

#userlist_enable=YES

#enable for standalone mode

listen=YES

#tcp_wrappers=YES

 

vi  chroot_list

# vsftpd userlist

# If userlist_deny=NO, only allow users in this file

# If userlist_deny=YES (default), never allow users in this file, and

# do not even prompt for a password.

# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers

# for users that are denied.

root

bin

daemon

adm

lp

sync

shutdown

halt

mail

news

uucp

operator

games

nobody

vidal    --------------------------------------------->  your given username

/usr/sbin/adduser -d /home/ftpusername  ftpusername

Vi /etc/shells

/bin/false

 
 

How change Zone Timeing

 

How change Zone Timeing

 

mv /etc/localtime /etc/localtime_old

ln -s /usr/share/zoneinfo/EST /etc/localtime

 

EST = Zone timeming

Make backup script date to date tar

#! /bin/bash

echo Backup Started `date` >> /root/backuplog

mkdir /mnt/plutobackup/www/`date +%Y%m%d`

tar -cvzf /mnt/plutobackup/www/`date +%Y%m%d`/html.tar.gz /var/www/punehtml >> /root/backuplog

mkdir /mnt/plutobackup/sql/`date +%Y%m%d`

tar -cvzf /mnt/plutobackup/sql/`date +%Y%m%d`/sql.tar.gz /var/lib/mysql >> /root/backuplog

echo Backup Completed `date` >> /root/backuplog

 

Make backup script

#!/bin/bash

rsync -rv /var/www/punehtml /mnt/plutobackup/www   > backup.log

rsync -rv /var/lib/mysql /mnt/plutobackup/sql   > backup.log