Recently I have given a speech on 'Architecting your application for the cloud' on Basis Softexpo 2012. I have uploaded my slides on slideshare. You can get the slides from here.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
Sunday, February 26, 2012
Friday, February 17, 2012
Logrotate for virtual hosts
First create a file named 'virtualhosts' under /etc/logrotate.d/ folder. Then we set the path of the log files for our virtual hosts into the file. Suppose we have two virtual hosts for domain1.com and domain2.com. Then our file will be as the below:
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
/path_to_domain1.com_log/*log /path_to_domain2com_log/*log {
rotate 14
daily
compress
delaycompress
sharedscripts
postrotate
/usr/sbin/apache2ctl graceful > /dev/null
endscript
}
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
minimize attack with iptables
You can minimized DDOS attack with some basic actions with the iptables.
Syn-flood protection:
Make sure NEW incoming tcp connections are SYN packets; otherwise we need to drop them:
Packets with incoming fragments drop them. This attack result into Linux server panic such data loss.
Incoming malformed XMAS packets drop them:
Incoming malformed NULL packets:
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
Syn-flood protection:
In this attack system is floods with a series of SYN packets. Each packets causes system to issue a SYN-ACK responses. Then system waits for ACK that follows the SYN+ACK (3 way handshake). Since attack never sends back ACK again entire system resources get fulled aka backlog queue. Once the queue is full system will ignored incoming request from legitimate users for services (http/mail etc). Hence it is necessary to stop this attack with iptables.
Force SYN packets check:Make sure NEW incoming tcp connections are SYN packets; otherwise we need to drop them:
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROPForce Fragments packets check
Packets with incoming fragments drop them. This attack result into Linux server panic such data loss.
iptables -A INPUT -f -j DROPXMAS packets
Incoming malformed XMAS packets drop them:
iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROPDrop all NULL packets
Incoming malformed NULL packets:
iptables -A INPIT -p tcp --tcp-flags ALL NONE -j DROP
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
How to prevent DDOS attack
Different people are sitting there in the world to make DDOS attacks. This kind of attack main done by web hosting company to crush other hosting servers. You can prevent DDOS attack with the following steps:
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
- 1. use iptables
- 2. Use log rotator
- see access log and block the attacker's IP address,
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
How to block an IP address
You can block a malicious IP address with the iptables. you can stop all incoming request from that specific address with the following command:
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
sudo /sbin/iptables -I INPUT -s 173.242.125.206 -j DROP
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
How to configure logrotate
you can find the main logrotate configuration file in
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
/etc/logrotate.confThis shows the default rules for log rotation. we will get the application specific configuration on
ls /etc/logrotate.dSet the rotation count with
rotate 4So, we will get four log file. We can specify the interval also with
weekly daily monthly yearlyWe limit the log file size with
size 100k size 100M size 100GHere we limit the size to 100 kilobytes or 100 megabytes or 100 gigabytes, use the one that you needs. We compress our log file
compress delaycompress nocompresswith delaycomress we delay the compresssion. delaycomress only works if you define compress. You can directly apply the changes with the below command:
/usr/sbin/logrotate /etc/logrotate.conf
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
how to empty a file in linux
You can empty a file using the following command without deleting it in unix environment:
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
cat /dev/null > largefileit's empty now. :)
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
Friday, February 10, 2012
Joomla! Mobile Development Beginner’s Guide is out now
Hey everyone, want to develop websites for mobile devices with Joomla, 'Joomla! Mobile Development Beginner’s Guide' is out there. go get your copy and start developing. In the coming days, I will also discuss about different feature of the book. Thanks. You can order from here.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
How to create a git repository
To create a git repository, create a folder of the project name, like 'test'.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
mkdir testThen go into the folder with:
cd testAnd run the below command
git --bare initNow, go to your local machine, and run the below commands:
mkdir project cd project git initAnd create your project files here.
git add . git commit -am 'message' git remote add origin ssh:user@ipaddress:/path_to_project git push origin masterThen you can make a clone of your repository on your server machine now:
git clone user@ipaddress:/path_to_project
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
Wednesday, February 8, 2012
Create init page for nginx
In this article, we will create an init page for nginx server. Open the file with nano.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
sudo nano /etc/init.d/nginxThen write the following code in the bash file:
#! /bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/sbin/nginx
NAME=nginx
DESC=nginx
test -x $DAEMON || exit 0
# Include nginx defaults if available
if [ -f /etc/default/nginx ] ; then
. /etc/default/nginx
fi
set -e
case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --pidfile /usr/local/nginx/logs/$NAME.pid \
--exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet --pidfile /usr/local/nginx/logs/$NAME.pid \
--exec $DAEMON
echo "$NAME."
;;
restart|force-reload)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --pidfile \
/usr/local/nginx/logs/$NAME.pid --exec $DAEMON
sleep 1
start-stop-daemon --start --quiet --pidfile \
/usr/local/nginx/logs/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
reload)
echo -n "Reloading $DESC configuration: "
start-stop-daemon --stop --signal HUP --quiet --pidfile /usr/local/nginx/logs/$NAME.pid \
--exec $DAEMON
echo "$NAME."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0
We change the permission on the file.
sudo chmod +x /etc/init.d/nginxAnd then added it to run on the boot time of the server.
sudo /usr/sbin/update-rc.d -f nginx defaults
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
bind() to 0.0.0.0:80 failed (98: Address already in use)
I have installed nginx server on ubuntu 11.04(Natty Narwhal). After installation while I start the nginx server, I got the error:
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
bind() to 0.0.0.0:80 failed (98: Address already in use)I found the apache server is running on the same port on 80. So, I stop the Apache server and The error gone.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
jQuery Mobile jumpy and blinky issue
I have used jQuery mobile and implemented transition effect into my site. Then some pages jump to previous and next page. This issue is known as 'Jumpy and blink issue'. I have removed the the page transition effect and set the following:
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
defaultPageTransition: none.Then the problem solved. :)
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
svn: Error converting entry in directory '/' to UTF-8
I have got an error describing that some filenames can't be converted to UTF-8 format while committing to svn. Later I found that there was some space in the filename like 'tahsin hasan'. It's a valid name in windows, but it's not a valid in unix environment. I have changed the names, then the error was resolved.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide
Subscribe to:
Posts (Atom)

