Showing posts with label website. Show all posts
Showing posts with label website. Show all posts

Wednesday, December 06, 2006

Home Linux Server Part 2: Web Server setup

This is the second installment of my series of posts on setting up a Linux-based server on your home network. In Part 1, we set up Debian 3.1 on an old system to run as the server, set up the telnet daemon, and installed a basic GUI but prevented it from running on boot.

Now in Part 2, we will configure our box as a Web server open to the public (if you want) using Apache. I am assuming your system is configured as per Part 1. Thus, you have a static internal IP address assigned to your server, and a unique hostname. Also, these instructions will allow you to create a publicly accessible web server even if you have a dynamic public IP address assigned to you by your ISP. For example, on my network, my server has hostname present-server and internal IP address 192.168.2.99. However, my public IP address is dynamically assigned by my ISP, Verizon DSL, and changes unpredictably. Using these instructions, however, my web server is always available from outside my network via http://present-server.dyndns.org:8080.
  1. Log into your server as root, or use telnet to log in as a regular user and run su to enable root access.
  2. Install Apache with the command apt-get install apache. When prompted, do not enable suExec.
  3. Apache defaults to the main server directory being /var/www. In this directory should always be a file called index.html. When installed, Apache creates a default dummy index.html. To see this file, point your web browser to the internal IP address of your server. This causes the browser to connect to your server on the default HTTP port, port 80. Apache intercepts this, and directs the visitor to the index.html file found in /var/www. However, this is the highest directory the visitor can access.
  4. You probably want to keep the default index.html file around, but obviously do not want it to be the page your visitor sees when he navigates to your site. Thus, rename the file with mv /var/www/index.html /var/www/index.html.old. Now, you can use the /var/www directory to hold all of the files needed for your website. Be sure to create a new index.html file as the entrance page for your site.

Now your web server is fully functional if you want it to remain accessible only to those within your home network (i.e., to the intranet). Continue if you want to open it up to the internet.
  1. You need to tell your router to pass any HTTP requests from outside your network on to your server for Apache to handle. Thus, you need to forward port 80 in your router's Port Forwarding Settings to the IP and MAC address of your server. You can find the MAC address of your server with the command ifconfig. You may need to be logged in as root to run this command. The MAC address (also known as a hardware address, and is a unique number identifying your Network Interface Card to other computers) is shown next to HWaddr in the eth0 entry. Port forwarding differs from router to router. Consult your router documentation for this process.
  2. Now we need to find a Domain Name Server (DNS) to put our site in its zone. DynDNS.com provides a free service that places dynamic public IP addresses in its zone, provided you use a sub-domain of theirs (that is why my site's address is http://present-server.dyndns.org:8080). To set this up,
    1. Create a free account on DynDNS.com.
    2. Click "Dynamic DNS" under "Services," and then click "Create Host."
    3. Set the hostname to the same thing as the hostname on your server, and select an upper-level domain of your choice. Go to WhatIsMyIP.com, and put your public IP address in as the IP address in DynDNS. Click "Add Host" to complete the registration.
    4. You will not be able to test this domain if your router, like many, does not support loopback connections. Therefore, ensure there is a valid domain registration by asking a friend to point their browser to the domain you configured. They should see the index.html page you have put up if your ports are forwarded properly and the domain is set up correctly.

  3. Dynamic IP addresses, by definition, change sometimes. Thus, we need a way for our entry at DynDNS.com to update with the new IP. We will use the ddclient service for Linux to manage the updating automatically.
    1. Install ddclient with apt-get install ddclient.
    2. Select dyndns from the list of services.
    3. Enter in the domain your registered at DynDNS as the "fully qualified domain name."
    4. Enter the username and password you use to log in at DynDns.com.
    5. Enter the interface your webserver is using as an NIC. This is most likely eth0.
    6. Select No when asked if you want ddclient to run whenever a ppp connection is created.
    7. Enter 30d for a 30-day update cycle when prompted.
    8. Choose to run ddclient as a daemon so you do not have to start the service every time you reboot the server.
    9. Edit the configuration file /etc/ddclient.conf to enable access from behind a Cable/DSL router.
      • Run nano /etc/ddclient.conf as root to edit the file.
      • Replace the line use=if, if=ppp0 with the line use=web, web=checkip.dyndns.org, web-skip='Current IP Address: '
      • Press Ctrl-X, Y, Enter to save the configuration file and quit nano. Run ddclient to update the IP and make sure the daemon is working. This will run automatically every 30 days, but if you know your IP address has changed, run it manually to make the changes immediately effective.

Note: Some ISPs, including Verizon DSL, block listening on HTTP port 80 to try to discourage servers running with the less-expensive dynamic IP addresses, and get you to buy a static IP. If this is the case, you need to change the operating port to something besides 80. Edit the /etc/apache/httpd.conf file, replacing the port on the port 80 line with a different number. I recommend using port 8080. Then, change which port is forwarded by your router as well. When pointing web browsers to your site, you are no longer using the default port, so you need to tell which port to connect on. That is why my site is referred to with http://present-server.dyndns.org:8080.

Great. Apache web server should be up and running, and your DNS should be automatically updated and accessible from the internet. Have a friend check your site from the outside using the domain you registered with DynDNS, specifying the port you chose. If you need to view your site internally, you need to direct your browser to the internal static IP address on the specified port unless your router supports loopback addresing.

Wednesday, October 11, 2006

Rapidshare.de, I forget about you

There's one website in particular that I use regularly but haven't given much thought. I almost take it for granted that everyone knows about it. It's Rapidshare.de. Take a look at it yourself, you'll see why it's so great.

It's a fast and easy way to send files to people, without needing email addresses or setting up direct connections in P2P programs like Limewire. Their FAQ will do a better job describing it than I probably can; basically, you enter the path you want to upload, and it it returns a download link you can distribute.

There isn't much more to it. Rapidshare is simple to use, and effective. Like me, you might not see a need for it, but once you try using it you'll realize it's more useful in more places than you'd expect.

Thursday, June 22, 2006

Slimming down Ajax

Ajax is an impressive technology--both in appearance and potential. Already, it's infiltrated the web in Gmail, Flickr, meebo, Writely, and thousands of other sites that use a combination of Javascript and XML to dynamically refresh page components.

However, that combination, specifically the XML, provides a major drawback to Ajax applications. Each broswer--IE, Firefox, Opera, Safari, etc--parse XML differently. Thus, Ajax-coded webpages need a large amount of browser-specific code to make it work. The program becomes larger and consequently slower on the net. That's bad.

So how can it be fixed? How can we make Ajax work the same on every browser. Webmonkey reports one idea, called Fjax, that uses Flash to parse the XML and thus remove all browser-specific code forking. The result is a much smaller and more streamlined program--all of the XML parsing, for every browser, is done in less than 4Kilobytes. When was the last time you saw something less than 4K?

Already, Ajax provides much of the functionality as desktop programs. Maybe with technologies such as Fjax, we'll start seeing the same speed.

Sunday, June 04, 2006

Registered with Technorati

I claimed my blog with Technorati this morning. Blogger, my blog host, automatically put me in Technorati's registry already, but by registering I added tagging support and accessibility to a few more features. For example, on the sidebar now there's a Technorati box, search, and profile.

Mostly, I added my blog to Technorati to try to get some more visibility. According to Statcounter, there are only a few IPs who regularly visit my blog for any length of time greater than 5 seconds. Thanks to those of you who do; I'm glad you like what you read.

Thursday, June 01, 2006

Last.fm--The Social Music Revolution

I just signed up with Last.fm, a social networking music community. I think it's going to be really cool. It uses open-source plugins and players (under the Creative Commons license) to integrate with your media library and current media player (support for WMP, iTunes, Winamp, and a bunch more), to automatically send anonymous listening information to your account. It synthesizes the data it recieves, and builds a set of "Neighboring" users who like the same music as you. You can listen to their songs if they have a paid account.

Last.fm also has web radio stations of a bunch of different genres at 128kbps (CD-quality) that stream through an opensource, extremely small player. Last.fm supports tagging, blogging, etc.

It also generates listening statistics for you, following trends automatically.

To me, however, it's the community surrounding Last.fm that seems most wonderful. I never jumped on the MySpace bandwagon--I'd rather stick with real friends, not virtual avatars. But Last.fm is your "music friends." I like that: it's a way to find out about bands that I'd never find otherwise.

Which is the other plus of Last.fm. There's a massive library of full-streaming and 30-second sample streaming indie songs that are really good, but don't get publicity because they aren't on a major label.

Finally, here's my Last.fm profile. If you like what I listen to, add me to your friends list.

Last.fm also generates a list of the most recent songs you listened to. Here's mine as of this posting:

Edit: Actually, the above list isn't as of the posting; it changes automatically as I listen to more music. What you're looking at now is the most recent songs I've played on my computer.

Thursday, March 23, 2006

Writely Aquired by Google

The AJAX-based online word-processing application Writely has been acquired by Google. I wrote about Writely a few posts back, and still give it my praise--it's a great program that really fills a niche.

But what does the merger mean for us users? Well for one, Writely has temporarily discontinued new registrations until the transition to Google's servers is completed. Writely claims to not change things--for now-- and the merger should allow the start-up to make some serious improvements under Google's massive budget. The team working on the Writely project should increase as well.

I'm wary about Google's AdSense program slipping in on Writely, however. Google has had the habit of providing useful, streamlined, and powerful services with their trademark clean interfaces, but then adding their text ads later down the road. Look at Gmail, for example. Writely claims this will not happen until users are notified, but how much good will that do once the users have established a portfolio of work on Writely?

From the looks of it, no major changes are occuring to Writely as a result of the merger for some time. Nonetheless, I'm not certain if this was the best decision for Writely. I'm a believer in the *nix philosophy: Do one thing and do it right. Since Google went public in 2004, it has been straying from its own domain--web searching. Hopefully Google can keep doing Writely "right" (write?).

Wednesday, March 01, 2006

Wikipedia Hits 1,000,000

Slashdot reports that Wikipedia, the online, user-edited encyclopedia, has reached its one-millionth article today at 6:09pm EST. The article is about the Jordanhill Railway Station.

Here are few highlights that caught my attention in the Slashdot thread:

  • znx writes, Even if you consider only 10% of the wiki as "useful content", that still means 100,000 articles. Which is just below that of Encyclopedia Britannica (which was established way back in 1768!). This is a milestone along the way, the wikipedia isn't perfect but it is a great project that should be celebrated for its success.

  • fm6 writes, I find it interesting that the "official" one millionth article is one of those obscure geographical articles that help justify Wikipedia's existence. It's the sort of narrow topic that old-fashioned encylopedias would never get to, but which is actually useful to certain people. But it's a little strange that the counter hit 1 million on such an article. By percentages it should have been a vanity article, a topic that exists mainly in the mind of the author, or a summary of a TV episode.

  • niktemadur writes, 1,000,000 articles in English. If you take all articles in all languages, Wikipedia surpassed the magic number a long time ago, and has by now actually gone beyond 2,000,000 articles.


Also, interestingly enough, Wikipedia user Mészáros András predicted that today (i.e., March 1, 2006) would see the official authorship of Wikipedia's one-millionth article.

The count to one-million does not include redirects and stubs. If those were included, Wikipedia would have over 2.5 million articles.

There is of course the expected debate (seeing as it is a Slashdot thread) on the value, accuracy, and reliability of Wikipedia. One Slashdotter posted a link to Uncyclopedia, a parody of Wikipedia with the slogan "The content-free encyclopedia that anyone can edit," compared to Wikipedia's slogan "The free encyclopedia than anyone can edit."

Sunday, February 26, 2006

StatCounter Tracks My Hits

Take a look on the right-hand column of this page. Scroll down. See the little icon that says "StatCounter?" It looks like this:


StatCounter


StatCounter is a tool I found to see the usage statistics for this web site. It seems to be able to provide some pretty insightful information, including

  • Unique, Returning, and Total visitors
  • Browser, Javascript enabability
  • Operating system, resolution
  • IP address (so yes, I am logging you right now. I guess I should let that be a disclaimer of some sort.)
  • Referring pages, exiting pages
  • Search engines--and the search terms--that users found the site with
  • Length of visits, pages visited
  • Location, ISP

There's probably more I haven't found out yet. But best of all, the service is completely free. If you're looking for some basic demographic information for your blog or site, I'd recommend it.

Friday, February 24, 2006

Writely Shows the Potential of Web2.0

The Web2.0 and AJAX craze is showing us dozens of potential web-based applications that might one day bring the desktop-based computing world as we know it to its knees. AJAX programs include meebo for instant messaging, Gmail for email and chat, and more.

But one AJAX application has really caught my eye: Writely, a web-based word processor.

While only in beta, Writely can seem a little rough around the edges, and occasionally makes a few mistakes. But it has the potential to rival desktop-based solutions such as OpenOffice.org and Microsoft Word. In fact, Writely can upload existing HTML, plaintext, rich-text, MS Word Documents, and OpenOffice .odt and .sxw documents. It can support .gif, .png, .jpg, and .bmp images for embedding in your files.

I experimented a bit with Writely, but came away happy. I only had a few minor problems, as is expected from a beta service. I lost some tab formatting in an rtf document that I uploaded. I had trouble getting cut/copy/paste to work, but the problem appears to be a compatibility issue with Firefox that can be fixed. And the Undo button wouldn't work for autocorrections made by the spell-checker. Also, Writely provides an RSS feed of documents you made public (i.e., available for others to see), but this proved a bit finicky. I did not experiment with Writely's vast set of collaboration tools, but they seem easy to use and powerful.

I successfully created a test document from scratch online, applied various special formatting, bulleted and numbered lists, tables, page breaks, horizontal lines, hyperlinks, and just plain content. I exported it to MS Word .doc successfully.

Overall, Writely as it stands provides a free, efficient, clean solution to most word processor users. I look forward to it coming out of beta as a functioning and streamlined product. If more web developers can create applications (and I don't use that term lightly; Writely came across as equally powerful to many desktop programs) with Writely's potential, then Web2.0 might succeed.

EDIT: Slashdot recently posted a thread about Web2.0 that features some more AJAX examples worthy of mention.

Thursday, February 23, 2006

My Forty-Two Cents is Live!

Hello, World!

I finally decided to join the hordes of internet junkies known as "bloggers" today. Actually, I decided at 6:24pm EST.

So anyways, welcome. I'm glad to see somebody is reading this blog. I can tell you now that its content will vary. My interests vary, so whatever happens to catch my eye in the news, on an Atom feed, in another blog, etc. is fair game for me to post about.

When you look at my blog site, one of the most prominent features is the title: My Forty-Two Cents. In Douglas Adams' humorous and enlightening commentary on "life, the universe, and everything," The Hitchhikers Guide to the Galaxy, the answer is simply 42. Much emphasis is also put on the fact that nobody actually knows the question to which the answer is 42, but that's an entirely different matter. And of course, "My Forty-Two Cents" is a pun on "My Two Cents."


I'll try to post as often as I can, but sometimes these types of things slip through the cracks. Please be patient, because I know the entire cyber-community is simply on the edge of its seat to read what I have to say. But then again, that's what Stephen Hawking thought when he said his book The Universe in a Nutshell belonged on every person's coffee table. And he's a lot smarter than I am.