Hosting a Website from Local Machine

I am sure you would have thought atleast once of hosting your website from your machine itself, if not the website atleast a sandbox version of it as it would be comparatively easy for you to maintain it so i discuss the steps you need to follow to achieve this, first lets go through the requirements, in this post i am talking about small sized sites a minor modified version of this post is applicable for large sites as well.

Requirements

1) A really broad Internet Connection.
2) A Static IP
3) A High End Machine (if the site you are hosting is pretty static a lower end machine is sufficient to be more clear a dynamic personal blog kind of site will also never need more than 1000 Mb of RAM unless you are the Top blogger of the country)
4) Server Software (Apache preferred)
5) A Database Server (if needed, mysql/postgresql recommended)
6) Scripting Support (might be PHP. perl, python as per the requirements)

In simple words your local LAMP machine can work as the server for your website :)

I have the machine ready with a good internet connection and a static IP Now what

Hey you are almost done just a few entries here and there and you host the website from your home

Now you will need to resolve your domain to your IP address, now whats it and how will i do this

Its quite simple you need to add an entry in DNS so that it can resolve this, request your registrar to do this for you if you are unable to do this, generally you would be able to do this at no additional costs, in simple terms if you have registered a domain say example.com and your static IP is x.x.x.x then example.com should resolve to x.x.x.x thats it.

Once the above step is done and are planning to host only one website then your setup is ready :) if you need to host more than one domains on this single machine just add virtual hosts in your server configuration for each of the domains and make all domains pointing to same IP.

What else you will have to do ?

Keep this machine up 24x7 after all you will not like your site to be down

 

Also dedicate the machine as server dont try playing games on it, its a server now and putting extra load to it will slow down your site performance

I would warn hosting a server is not that easy as it looks like security issues can pop up now and then and you should be technically sound to handle this so its recommended spending some amount and  take a hosting plan from someone in the business after all he is there for providing you services.

Key Based Authorization with SSH

Using remote shells is all time favourite but remembering those many passwords is a pain so here are the steps to login using SSH without putting a password :)

 

1. Create a public ssh key, if you haven’t one already. Look at ~/.ssh. If you see a file named id_dsa.pub then you obviously already have a public key. If not, simply create one.

ssh-keygen -t dsa should do the trick. Please note that there are other types of keys, e.g. RSA instead of DSA.

2. Make sure your .ssh dir is not publically writable

    # chmod 700 ~/.ssh

3. Get your public ssh key on the server you want to login automatically.
   
    #scp ~/.ssh/id_dsa.pub remoteuser@example.com

4. Append the contents of your public key to the ~/.ssh/authorized_keys and remove it.

Important: This must be done on the server you just copied your public key to. Otherwise you wouldn’t have had to copy it on your server. Simply issue something like

 

    # cat id_dsa.pub >> .ssh/authorized_keys while at your home directory.

 

5. Instead of steps 3 and 4, you can issue something like this:
   
    # cat ~/.ssh/id_dsa.pub | ssh -l remoteuser remoteserver.com 'cat >> ~/.ssh/authorized_keys'

   6. Remove your public key from the home directory on the server.

   7. And you are in

    # ssh -l remoteuser example.com
        or
    # ssh remoteuser@example.com

 

 without getting asked for a password.

Drupal Modules you cant live without

Drupal is one of the most flexible Content Management System available and Its been more than 18 months since i am using it and have tried and tested lot many  modules, in this post i try to categorize non core drupal 6 modules on the basis of my experience in must have and enhance your site categories. i am sure this list would change with time

Modules you cant live without

Enhance your site using the below

Configuring Apache with SSL

Apache is the most common web server used now a days, you would have already configured apache many times by now but what about configuring it with SSL i.e. using apache to service on the https protocol, i assume you have already configured the basic apache server and have also enabled the SSL module, if not refer to my previous post on Configuring Apache Web server.

The following post is an extremely simplified step by step guide to configure SSL in apache using Self Signed Certificates you can also use a real certificate issued by a CA if you have it

Prerequisites

1) Apache with SSL module enabled
2) openssl installed

Step 1) Generate a Private Key

We will use the openssl toolkit for generating a RSA Private Key and Certificate Signing Request, as the first step generate the key the command below will create a 1024bit key using 3des

abhishek@kashipur.in:~$ openssl genrsa -des3 -out server.key 1024
Generating RSA private key, 1024 bit long modulus
......................++++++
..................................++++++
unable to write 'random state'
e is 65537 (0x10001)
Enter pass phrase for server.key:
Verifying - Enter pass phrase for server.key:

Step 2) Generate a CSR (Certificate Signing Request)

Once the key is generated you will need to make a CSR or Certificate Signing Request, using the following command you can generate a CSR in this process you would be asked to enter various parameters as shown below

abhishek@kashipur.in:~$ openssl req -new -key server.key -out server.csr

Enter pass phrase for server.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:IN
State or Province Name (full name) [Some-State]:UK
Locality Name (eg, city) []:Kashipur
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Kashipur Networks
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:kashipur.net
Email Address []:abhishek at kashipur dot net

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

Step 3) Remove Pass phrase from Key

This is completely an optional step if you skip this you will have to run to the server as and when the server restarts to enter the pass phase :) , use the following commands to get rid of this problem

abhishek@kashipur.in:~$ cp server.key server.key.org
abhishek@kashipur.in:~$ openssl rsa -in server.key.org -out server.key

Enter pass phrase for server.key.org:
writing RSA key

Step 4) Generating a Self-Signed Certificate

Once you have your Key and CSR ready its time to generate the Certificate use the following command to generate a certificate

abhishek@kashipur.in:~$ openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Signature ok
subject=/C=IN/ST=UK/L=Kashipur/O=Kashipur Networks/CN=kashipur.net/emailAddress=abhishek at kashipur dot net
Getting Private key

Step 5) Copy Certificate and Key to Apache Folder

After following the steps above you would have the following files generated

abhishek@kashipur.in:~$ ls -l

-rw-r--r-- 1 abhishek abhishek 952 2009-06-12 14:30 server.crt
-rw-r--r-- 1 abhishek abhishek 704 2009-06-12 14:27 server.csr
-rw-r--r-- 1 abhishek abhishek 887 2009-06-12 14:29 server.key
-rw-r--r-- 1 abhishek abhishek 963 2009-06-12 14:28 server.key.org

Copy the crt and key file to a preferable location inside the apache configuration folder generally /etc/apache2/cert using the following command

abhishek@kashipur.in:~$ cp server.crt server.key /etc/apache2/cert

Step 6) Configure Apache with SSL

Once you have your Certificate and Key copied, modify your httpd.conf to reflect the following

SSLEngine on
SSLCertificateFile /etc/apache2/cert/server.crt
SSLCertificateKeyFile /etc/apache2/cert/server.key
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
CustomLog logs/ssl_request_log \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

Ensure apache is listening to Port 443 if not add the Listen Directive. After making these changes preferable verify the configuration file using the following command

abhishek@kashipur.in:~$ apache2ctl configtest
Syntax OK

Once you see Syntax OK you are ready to use https.

Step 7) Restart Apache and test

To apply the configuration changed you need to restart apache which can be done using the following command

root@kashipur.in:~# service apache2 restart

or

root@kashipur.in:~# service httpd restart (in many cases)

Once you restart test it by appending https:// to the URL

Happy HTTPS :)

Configuring BSNL EVDO Modem in Debian GNU/Linux

EVDO DeviceI recently shifted to Debian GNU/Linux (Lenny), and the first task included configuring my Internet Connection, i use BSNL EVDO Modem to connect to the internet which is not recognized my default in Debian so following is the process by which i configured my BSNL EVDO in Debian

Step 1) Checked for Modem, Vendor and Product ID

$ cat /proc/bus/usb/devices

You will find many entires in this just check for your modem entry in my case i found

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  4 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=19d2 ProdID=fffe Rev= 0.00
S:  Manufacturer=ZTE, Incorporated
S:  Product=ZTE CDMA Tech

by this i know the following information

Vendor=19d2
ProdID=fffe

Step 2) Detect modem (as root user)

# modprobe usbserial vendor=0x1952 product=0xfffe

Note : appending "0x" before Vendor and ProdID is a must

Step 3) Replug The Modem

Check if its detected using dmesg

# dmesg

[   14.280399] usbcore: registered new interface driver usbserial
[   14.280399] usbserial: USB Serial support registered for generic
[   14.280399] usbserial_generic 1-1:1.0: generic converter detected
[   14.280399] usb 1-1: generic converter now attached to ttyUSB0
[   14.280399] usbserial_generic 1-1:1.1: generic converter detected
[   14.280399] usb 1-1: generic converter now attached to ttyUSB1
[   14.280399] usbserial_generic 1-1:1.2: generic converter detected
[   14.280399] usb 1-1: generic converter now attached to ttyUSB2
[   14.280399] usbserial_generic 1-1:1.3: generic converter detected
[   14.280399] usb 1-1: generic converter now attached to ttyUSB3
[   14.280399] usbcore: registered new interface driver usbserial_generic
[   14.280399] usbserial: USB Serial Driver core

from this you come to know that your modem Device is ttyUSB0

Step 4) Install wvdial

# apt-get install wvdial

Step 5) Configure wvdial

edit the wvidal configuration file (/etc/wvdial.conf) below is my wvdial.conf this should work for you aswell

# gedit /etc/wvdial.com

[Dialer Defaults]
Modem = /dev/ttyUSB0
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Stupid Mode = on
Modem Type = Analog Modem
Phone = #777
ISDN = 0
Username = cdma
Password = cdma
Baud = 9600

Step 6) Connect :)

# wvdial

hey you are now connected.....

Step 7) Adding the Modem Detection @ startup

edit /etc/modules and add the following

usbserial vendor=0x1952 product=0xfffe

# gedit /etc/modules (add the above line)

Notes : wvdial runs as a super user to enable this for normal user you need to edit user permissions.

हिन्दी लोकीकरण योजना

हिन्दी लोकीकरण योजना का पहला अनुवाद पैकेज अब डाउनलोड के
लिये http://drupal.org/project/hi पर उप्लब्ध है !

हिन्दी लोकीकरण योजना
प्रगति की स्थिति

# ४ योगदानकर्ता
# ४८१५ अनुवाद करने के लिए शेष
# ४२३ अनुवाद दर्ज

अब आप भी सुझाव जमा कर स़कते है नीचे दिये लिन्क पर जाकर

हिन्दी सुझाव के लिये
http://drupall10n.com/translate/languages/hi/edit?project=&status=1&sea…

Tuz the new mascot for Linux

Tux the Linux mascot will take a break for a while with the release of Kernel 2.6.29 Tuz would be replacing Tux.

Tuz mascot for 2.6.29

Tuz is a Tasmanian Devil, which is a species in danger of becoming extinct. The Tasmanian Devil is native to Australia and during this year's Linux.Conf.Au conference it was decided that Tuz will stand in for Tux for one kernel release in order to raise awareness for this creature. Tux will return with the release of the Linux 2.6.30 kernel :).

 

Whats in your MBR ??

Master Boot Record or the MBR max to 512 Kb but very essential have you ever looked at what your MBR contains most probably NO!!, so try out the following 2 commands as root and check your MBR Contents

# dd if=/dev/hda of=mbr.bin bs=512 count=1
# od -xa mbr.bin

This will display your MBR change hda to sda if u have an sda type disk, following is my MBR you might not understand anything from this but a careful look is required to know what is it :)

0000000 48eb d090 bc66 7c00 0000 c08e d88e e689
k H dle P f < nul | nul nul so @ so X ht f
0000020 bf66 0600 0000 b966 0100 0000 a5f3 23ea
f ? nul ack nul nul f 9 nul soh nul nul s % j #
0000040 0006 8000 80fa 057c fa80 7e87 b202 8880
ack nul nul nul z nul | enq nul z bel ~ stx 2 nul bs
0000060 4916 6607 bebf 0007 3100 66f6 04b9 0203
syn I bel f ? > bel nul nul 1 v f 9 eot etx stx
0000100 00ff 2000 0001 0000 0200 90fa f690 80c2
del nul nul sp soh nul nul nul nul stx z dle dle v B nul
0000120 0275 80b2 59ea 007c 3100 8ec0 8ed8 bcd0
u stx 2 nul j Y | nul nul 1 @ so X so P <
0000140 2000 a0fb 7c40 ff3c 0274 c288 be52 7d7f
nul sp { sp @ | < del t stx bs B R > del }
0000160 34e8 f601 80c2 5474 41b4 aabb cd55 5a13
h 4 soh v B nul t T 4 A ; * U M dc3 Z
0000200 7252 8149 55fb 75aa a043 7c41 c084 0575
R r I soh { U * u C sp A | eot @ u enq
0000220 e183 7401 6637 4c8b be10 7c05 44c6 01ff
etx a soh t 7 f vt L dle > enq | F D del soh
0000240 8b66 441e c77c 1004 c700 0244 0001 8966
f vt rs D | G eot dle nul G D stx soh nul f ht
0000260 085c 44c7 0006 6670 c031 4489 6604 4489
\ bs G D ack nul p f 1 @ ht D eot f ht D
0000300 b40c cd42 7213 bb05 7000 7deb 08b4 13cd
ff 4 B M dc3 r enq ; nul p k } 4 bs M dc3
0000320 0a73 c2f6 0f80 ea84 e900 008d 05be c67c
s nl v B nul si eot j nul i cr nul > enq | F
0000340 ff44 6600 c031 f088 6640 4489 3104 88d2
D del nul f 1 @ bs p @ f ht D eot 1 R bs
0000360 c1ca 02e2 e888 f488 8940 0844 c031 d088
J A b stx bs h bs t @ ht D bs 1 @ bs P
0000400 e8c0 6602 0489 a166 7c44 3166 66d2 34f7
@ h stx f ht eot f ! D | f 1 R f w 4
0000420 5488 660a d231 f766 0474 5488 890b 0c44
bs T nl f 1 R f w t eot bs T vt ht D ff
0000440 443b 7d08 8a3c 0d54 e2c0 8a06 0a4c c1fe
; D bs } < nl T cr @ b ack nl L nl ~ A
0000460 d108 6c8a 5a0c 748a bb0b 7000 c38e db31
bs Q nl l ff Z nl t vt ; nul p so C 1 [
0000500 01b8 cd02 7213 8c2a 8ec3 4806 607c b91e
8 soh stx M dc3 r * ff C so ack H | ` rs 9
0000520 0100 db8e f631 ff31 f3fc 1fa5 ff61 4226
nul soh so [ 1 v 1 del | s % us a del & B
0000540 be7c 7d85 40e8 eb00 be0e 7d8a 38e8 eb00
| > enq } h @ nul k so > nl } h 8 nul k
0000560 be06 7d94 30e8 be00 7d99 2ae8 eb00 47fe
ack > dc4 } h 0 nul > em } h * nul k ~ G
0000600 5552 2042 4700 6f65 006d 6148 6472 4420
R U B sp nul G e o m nul H a r d sp D
0000620 7369 006b 6552 6461 2000 7245 6f72 0072
i s k nul R e a d nul sp E r r o r nul
0000640 01bb b400 cd0e ac10 003c f475 00c3 0000
; soh nul 4 so M dle , < nul u t C nul nul nul
0000660 0000 0000 0000 0000 c6d7 0002 0000 0180
nul nul nul nul nul nul nul nul W F stx nul nul nul nul soh
0000700 0001 fe83 ffff 003f 0000 36a8 01e0 fe00
soh nul etx ~ del del ? nul nul nul ( 6 ` soh nul ~
0000720 ffff fe83 ffff 36e7 01e0 124d 00a0 fe00
del del etx ~ del del g 6 ` soh M dc2 sp nul nul ~
0000740 ffff fe82 ffff 4934 0280 3986 0040 fe00
del del stx ~ del del 4 I nul stx ack 9 @ nul nul ~
0000760 ffff fe05 ffff 82ba 02c0 6207 0690 aa55
del del enq ~ del del : stx @ stx bel b dle ack U *
0001000

G2Image in Drupal using TinyMCE with WYSIWYG API

UPDATE: This post is quite old now and wont work with the latest version of WYSIWYG API, will try to update this soon.

Gallery2 is one of the best galleries available which could be integrated with Drupal easily you would have read my post on integrating it earlier, after you have integrated it the bigger question is how get those images into your content or nodes so this posts answers it, after reading this post you would be able to integrate Gallery2 with your WYSIWYG (TinyMCE) Editor.

Prerequisites

The Steps

  1. Extract G2 Image Application in $DRUPAL_HOME/sites/all/modules/wysiwyg/tinymce/jscripts/tiny_mce/plugins/
  2. Open Gallery Setting in Web Browser from $SITENAME/admin/settings/gallery/g2image and enable G2Image for TimyMCE as shown in the image below
    gallery settings
  3. Once you have selected the Mode as TinyMCE add the following code in %drupal%sites/all/modules/wysiwyg/editors/tinymce.inc (function wysiwyg_tinymce_plugins($editor))

    'G2Image' => array(
            'path' => $editor['library path'] .'/plugins/G2Image',
            'buttons' => array('G2Image' => t('G2Image')),
            'internal' => TRUE,
            'load' => TRUE,
             ),

  4. Now enable G2Image button for TinyMCE from the editor profile at "admin/settings/wysiwyg/profile/edit/2"
  5. Thats it select G2Image button in TinyMCE

    it will popup a Galley as shown below for you to select images and insert them directly in your posts :)

    gallery Pop Up

Indic Touch to Drupal 6

Typing and display of any language other then English is always tough on the Internet to ease this we had various plugins coming in, i had also written a blog for akindic plugin for Drupal 5 last year, but what about the later and better versions of drupal, Gamabhana provides indic typing support but does not works with WYSIWYG API so this blog presents you a solution to type in Indic on Drupal using WYSIWYG API with TinyMCE

Prerequisites

The Steps

  1. Extract the Indic Plugin for TinyMCE in %drupal%sites/all/modules/wysiwyg/tinymce/jscripts/tiny_mce/plugin/indicime
  2. Add the following code in %drupal%sites/all/modules/wysiwyg/editors/tinymce.inc (function wysiwyg_tinymce_plugins($editor))

    'indicime' => array(
            'path' => $editor['library path'] .'/plugins/indicime',
            'buttons' => array('indicime' => t('indicime')),
            'internal' => TRUE,
            'load' => TRUE,
             ),

  3. Enable indicime button for Full HTML input format  from "admin/settings/wysiwyg/profile/edit/2"Adding indicime to TinyMce
  4. Enable rich text editor when creating Full HTML content and select the language from indicime dropbox as shown in the following image
    Adding indicime to TinyMce
  5. बस अब अपनी मन चाही स्थानीय भाषा मे टाइप् करे !