Hari's Corner

Humour, comics, tech, law, software, reviews, essays, articles and HOWTOs intermingled with random philosophy now and then

Linux self webhosting - HOWTO

Filed under: Tutorials and HOWTOs by Hari
Posted on Fri, Apr 13, 2007 at 14:28 IST (last updated: Thu, May 7, 2009 @ 21:00 IST)

In order to explore self-hosting, I decided to get myself a dyndns.org host name and find out how the whole thing works. This HOWTO is based on my own experience.

Setting up a simple home webserver is extremely easy. Instead of going with Apache, try something like boa. Not only is it very simple and lightweight, it normally requires no configuration at all. Even if you need to tweak any settings, its configuration file is very simple and easy to understand. Only if you need a lot of features or you're hosting dynamic pages like PHP, ASP or JSP you should use a more powerful server.

Here's a simple home website hosting how-to. I'm assuming that you have are behind a router. If you aren't and you have a permanent external static IP address for your machine, then it becomes even simpler (just avoid the port-forwarding step).

Step 1: Install a safe firewall configuration

In case you're not behind a router, you would need a firewall to block services not absolutely required for the outside world. If you are behind a router, then you won't need a firewall, but I still recommend one just as an added layer of security. A good idea would also be to simply disable any services running on the system which are absolutely not needed.

You don't absolutely need a firewall if you don't have any other services running on your machine which you don't want to expose to the outside world.

Guarddog is a great GUI firewall program that can configure an iptables firewall in double quick time. Install it and configure your firewall. The GUI is extremely intuitive and you won't need to know anything more than what services you want enabled (both incoming and outgoing from your machine). Make sure that all the services you need are enabled in the configuration and then apply it.

While configuring make sure you enable HTTP from local to internet zone.

If you're good enough to use iptables directly, then you may not even need my help ;)

Step 2: Install a webserver

There are many webservers you can use. If you're not really comfortable with Apache or simply don't need its added power you can install a really light-weight, no-frills webserver like boa or lighttpd.

If you're a user of Debian or Debian-based distros simply type:
apt-get install boa
From the command line and you're done. Or use the package manager of your distribution to get it or simply compile from sources.

Now make sure your webserver is working properly by typing http://localhost on your browser window. You should get whatever is the default home page of your webserver.

Add a index.html file in /var/www/ directory. You can also create a public_html directory in your normal user's home directory. You can access this by typing http://localhost/~user. Add whatever other web pages you wish to serve in either /var/www or (if you've enabled user directories) /home/user/public_html where user is your user name.

Step 3: Get a host name at DynDNS

Although you can set up your own name server if you have a domain name, you can also use DynDNS which is very convenient for dynamic IP hosts. Create an account. Log in and click on the "Dynamic DNS" link and click on "Add host." Type in the name of your website and choose an appropriate domain name (you have plenty of choices) and add it. Your current IP address will get hooked to it. That's all! You're now almost ready to host your website. If you have a static IP, you should probably create a "Static DNS" instead of the dynamic one.

Step 4: (If behind a router) Port forwarding

You can avoid this step if your machine has a direct static IP to the internet. Most likely in a home system, this is rare. If you're connected to the internet using any router, you need to follow this step.

This is the trickiest part of the whole setup. But don't worry. If you're using a router, then you need to get into the web administration panel of your router. Open a browser and type the internal address of your router (usually http://192.168.1.1) You will be prompted for the username/password of your router to proceed further.

Say your local machine IP is 192.168.1.10 and your router internal IP is 192.168.1.1. Your machine is like a client in a LAN and you need to make sure it can be reached from the outside world. Port forwarding is how you do this. By forwarding different ports, you can enable different services from your machine to the outside.

These are the general settings you would need to set in this screen: Once you apply these changes, the router will probably have to be restarted.

On some routers, this setup is also called Virtual Servers instead of Port Forwarding. Only enable the services you need to be forwarded in this set up.

Step 5: Testing it all out

Since you're behind your own webserver, you cannot test whether everything works well from your this system. Get another internet connection on a different PC and check the URL (which you created with the DynDNS account) in a browser.

If everything has worked well, you should see your own home page now. Congrats. :) If something is wrong and it doesn't work out, you should probably check whether you've done the previous steps properly.

To access your website from the server itself, you should probably type http://localhost in your browser window. ;)

Finally some points to note

Hope you found this guide useful. If there's anything you need clarification on, do ask!
Comments (5)  

கலக்கப் போவது யாரு

Filed under: Entries in Tamil by Hari
Posted on Thu, Apr 12, 2007 at 16:06 IST (last updated: Wed, Oct 29, 2008 @ 21:34 IST)

விஜய் டீவியில் இப்பொழுது கலக்கப்போவது யாரு "பார்ட் 3" நடந்துகொண்டிருக்கிறது. தொலைக்காட்சியில் வரும் மற்ற நகைச்சுவை நிகழ்ச்சிகளைப் போல இல்லாமல் இது வித்தியாசமாகத்தான் இருக்கிறது. எல்லோருக்கும் திரைப்பட நிகழ்ச்சிகளை சன் டீவியிலும், ராஜ் டிவியிலும், ஜயா டிவியிலும் பார்த்துப் பார்த்து சலித்துவிட்ட நிலையில் விஜய் டீவி செய்த இந்த நிகழ்ச்சியைய்ப் பாராட்டவேண்டியதுதான். ஆனால் இதில் பாருங்கள், ஏன் கிட்டத்தட்ட எல்லா பங்கேற்பாளர்களும் நம் "கேப்டனை" போல பேசியே வெற்றியடைகிறார்கள்? இதுவும் சில நாட்களில் நேயர்களுக்கு சலித்துவிடாதா?

நான் முதலில் இதை விரும்பிப்பார்த்தாலும், போகப்பொக பார்க்கவே தோணவில்லை. "மிமிக்கிரி" என்பது நல்ல நகைச்சுவையாக இருக்கவேண்டுமென்றால் ஒவ்வொரு முறையும் அதில் வேறுபாடு இருக்க வேண்டும். அதில்தான் புதிய திறமையை வெளிப்படுத்த முடியும். விஜய்காந்த், ராஜினிகாந்த், சிவாஜி, கமல்ஹாஸன், நமது எம்.ஜி.ஆர், இவர்கள் போல பிரபல நடிகர்களை அச்சடிப்பது சுலபம். அதிக திறமையுள்ளவர்களால்தான் மற்ற நடிகர்களையும் அரசியல்வாதிகளையும் நன்றாக அச்சடிக்க முடியும். எவ்வளவு நாட்களுக்குத்தான் செய்வதையே திருப்பித் திருப்பிச் செய்து நேயர்களை தொலைக்காட்சியின் முன் வைக்கமுடியும்?

மற்றபடி என்னால் இந்த நிகழ்ச்சியின் அமைப்பில் குறையொன்றும் கண்டுபிடிக்க முடியவில்லை. வாழ்க விஜய் டீவி! :-P
Comments (5)  

Minor CUPS tidbit - black and colour output

Filed under: Software and Technology by Hari
Posted on Wed, Apr 11, 2007 at 21:38 IST (last updated: Thu, Jul 17, 2008 @ 08:55 IST)

I was reconfiguring my HP PSC 1315 printer on my laptop today (as I had reinstalled Debian) and I accidentally stumbled on a minor issue I had been encountering all these days namely why I had been getting the colour cartridge to produce black text. This had been making printing slower and reducing the quality of the black output. I had simply left the Resolution, Quality, Ink Type, Media Type setting in Set Printer Options (in the CUPS interface) to "Controlled by Printout Mode." So it was either using the colour cartridge or the black cartridge exclusively to produce the output regardless of whether the page contained black or not.

Just changing this simple setting to another option (like "300 dpi, Color, Black+Color cartridge") fixed the issue. I thought it was a hpijs driver limitation, but it turned to be a configuration mistake on my part all these days.

Now I can print a mixture of pure black and colour on a single page and don't have to keep changing the printer options every time I want pure black printouts - something that had been bugging me for a long time now.

Just thought I'd make a note of this here, since I'm likely to forget this over time. This should also help others who've been having the same problem and wondering why they don't get pure black printouts by default just like in Windows.
Comments (0)  

முதல் தமிழ் பிளாக் போஸ்ட்

Filed under: Entries in Tamil by Hari
Posted on Tue, Apr 10, 2007 at 14:29 IST (last updated: Wed, Oct 29, 2008 @ 21:30 IST)

சுமார் இரண்டு வருடங்களாக பிளாக் செய்துவருகிறேன். அதில் ஒன்றுகூட தமிழில் இல்லையா? என்ன அநியாயம்? என்ன கொடுமையிது சரவணா? என் தாய்மொழிக்கே நான் துரோகம் செய்வேனா? மன்னித்துவிடடா, மன்னித்துவிடு! அஹஹஹஹா... (அழுகை... கிண்டல் செய்யாதே!)

அதனால் நான் இப்பொழுது பிளாகில் ஒரு தமிழ் போஸ்டு எழுதப்போகிறேன். பொன்னாடையை எனக்கு வழங்கும்படி தாழ்மையுடன் கேட்டுக்கொள்ளுகிறேன். என்ன? கொடுக்கமுடியாதா? மவனெ சீவிடுவேன் சீவி... இன்னா மே?

உளரல் போதும், இத்தோட முடிச்சுகறேன், நைனா!

தடங்கலுக்கு வருந்துகிறோம். razz

Service will resume shortly for our English readers. We thank you for your patience and we hope you enjoyed the journey with us. :)
Comments (15)  

eng2tam - English to Tamil Unicode transliterator

Filed under: My software by Hari
Posted on Tue, Apr 10, 2007 at 12:51 IST (last updated: Thu, May 7, 2009 @ 21:04 IST)

I've created a simple command-line program to convert phonetic English into Tamil (Unicode) in Linux. I found that there are plenty of language tools available for Indian languages, but nothing which comes close to being a simple phonetic translator. This script is not exactly feature-rich, but it does the job. It uses a simple one-to-one character conversion, so the phonetic conversion might not be too intuitive at first, but with a bit of learning, you'll be tying in double quick time.

It's usage is simple:
eng2tam <infile> <outfile>
Here's an example of the English input file:
`oru `Uril~ `oru raja `irun~tab~. `avb~ periy mkab~. vIrp~puli. cOk~kt~tg~km~.
And here's the Tamil output (you should see this in a Unicode aware browser with any unicode tamil font):
ஒரு ஊரில் ஒரு ராஜா இருந்தான். அவன் பெரிய மகான். வீரப்புலி. சோக்கத்தங்கம்.
Where <infile> contains the English phonetic script and <outfile> will be the file containing the transliterated unicode text in Tamil. The README file gives the complete character conversion table. The C++ source code is included with the tarred archive and you should be able to compile this program easily on other platforms as well.

Download: eng2tam.tar.gz (10.9 kB)

Dependencies: libc, libstdc++
Comments (15)  

Linux ACPI problem on HP nx series laptops

Filed under: Software and Technology by Hari
Posted on Sun, Apr 8, 2007 at 20:03 IST (last updated: Wed, Oct 29, 2008 @ 22:28 IST)

Till recently I had a hell of a time trying to find out why my laptop no longer had the ACPI functions enabled after upgrading to kernel 2.6.18 (Debian Etch). The thing is, ACPI is very important on a laptop - without it, I get no battery status, no poweroff, no hibernate, suspend and no thermal or fan monitoring.

There was a related problem with acpid mentioned on the Debian bug report archives which confused me for a while, but that bug had been addressed by the Debian developers. However, I managed to pinpoint the exact problem only today (after weeks and weeks of frustration). Why am I saying all this? Because I found out the power of the great command, dmesg. Yes, thanks to this, I found this error message (check the highlighted part):
#dmesg | grep ACPI
BIOS-e820: 000000000f7efc00 - 000000000f7fb000 (ACPI NVS)
ACPI: RSDP (v000 HP                                    ) @ 0x000fe270
ACPI: RSDT (v001 HP     099C     0x16090520 HP   0x00000001) @ 0x0f7efc84
ACPI: FADT (v002 HP     099C     0x00000002 HP   0x00000001) @ 0x0f7efc00
ACPI: MADT (v001 HP     099C     0x00000001 HP   0x00000001) @ 0x0f7efcb4
ACPI: MCFG (v001 HP     099C     0x00000001 HP   0x00000001) @ 0x0f7efd10
ACPI: DSDT (v001 HP       DAU00  0x00010000 MSFT 0x0100000e) @ 0x00000000
ACPI: Vendor "HP    " System "  DAU00 " Revision 0x10000 has a known ACPI BIOS problem.
ACPI: Reason: Bogus fan support. This is a non-recoverable error
ACPI: Disabling ACPI support
ACPI: Interpreter disabled.
pnp: PnP ACPI: disabled
PCI quirk: region 1000-107f claimed by ICH6 ACPI/GPIO/TCO
This led me to this to this bug report which describes the problem for HP nx based laptops.

The only fix seems to be to compile a newer kernel and unfortunately that's a bit tricky since pristine kernels from kernel.org don't play too well with Debian and tend to break a few things like iptables.

I'm posting this message in the hope that other owners of HP laptops with the same problem on Linux are aware of the real issue (and can get on to this post through web search). Trust me, it sounds easy now, but I had great difficulty in pinning down this problem right down to the kernel.

For those who want to follow the issue, please check this thread I've created in forums.debian.net.
Comments (1)