Tuesday, October 14, 2008

Point your domain to your home server

Just bought a domain name and want to host it at home? When people type in www.yourdomain.com how are they going to find you if you have a dynamic IP address? If your IP was static you could just use that and point the domain there.

Mine is not, so I use www.DNSexit.com they are free and it was very easy to setup and manage my domains.... AND they have a client that runs on linux that will update them if your IP address ever changes making your setup maintain itself.

So enter your domain in www.yourdomain.com into DNS, I believe they will automatically decect what your IP is, but if you want to find out yourself you can do www.whatismyip.com and paste that in.

Now login into godaddy.com, whoever your registrar was for your site and point your DNS servers to:

ns1.dnsExit.com
ns2.dnsExit.com
ns3.dnsExit.com
ns4.dnsExit.com

The 1, 2, 3, 4, etc... is for redundancy. Two should be fine.

Sometimes it takes awhile, up to 4-6 hrs, but once it is set up and your domain is pointed to the DNSexit DNS servers then you are all set and when you type in www.yourdomain.com it will come up with your website (Only if you have ports open on your router directing them to the right machine that is running a webserver).

Now to stop you from having to login and update your IP whenever it changes which usually only happens after a power outage really (at least for me). You can down the Dynamic Client from DNSexit.

Then run (if running debian/ubuntu):
dpkg -i ipUpdate-1.6-2.deb

Trouble shooting:
To make sure your server is running get on the machine and type "localhost".

Now lets see if the world can see it, type www.whatismyip.com and paste the IP into your browser. If you see your website great! If not then your ports on your router are not forwarding to the right machine.

Next, register with DNSexit and type in your domain name after 4-6 hrs, give them time to update their system. If you see your website you are done, if not they have not updated their system yet, or your domain name is not pointed to the DNS servers. You can do a WHOIS lookup on your domain to see what the current DNS servers are on it.

Good luck, enjoy,

How to restart you apache2 webserver (Ubuntu intrepid)

This is how you can restart your apache2 server:

sudo /etc/init.d/apache2 reload

How to set up virtual servers in apache2 (using Ubuntu Intrepid)

Assuming you have apache2 installed.

Go to /etc/apache2/apache2.conf

Open it with your favorite text editor and at the very end add:

NameVirtualHost 192.168.1.102


DocumentRoot /var/www/website1
ServerName website1.com
ServerAlias www.website1.com



DocumentRoot /var/www/website2
ServerName website2.com
ServerAlias www.website2.com


Ok now lets analyze what we just did.

This is the static IP address on my LAN. Whatever you pick you must open port 80 to redirect to this static IP address.

DocumentRoot /var/www/ben/website1 This is where I keep the material for my first website.

ServerName website1.com
ServerAlias www.website1.com

This will allow website1.com AND www.website1.com to work on the webserver, otherwise website1.com might return a site not found (401) error.

Close my virtual site.

You can have as many of these as you like as long as you don't exceed RAM, bandwidth, etc...

How to install a APACHE-PHP-MYSQL-PHPMYADMIN server on Ubuntu Intrepid

First I install the webserver
sudo apt-get install apache2

Then I install PHP5 with all the add ons:
sudo apt-get -f install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-imagick php5-mcrypt php5-memcache php5-mhash php5-mysql php5-pspell php5-snmp

Then I install MySQL database
sudo apt-get -f install mysql-server mysql-client

And finally phpMyadmin to manage your database from a GUI.
sudo apt-get -f install phpmyadmin

NOW TO TEST EVERYTHING

TESTING APACHE2
To test if apache is working open your browser and type:
localhost

If you see the text "It works!" Apache2 is running.

TESTING PHP5
Navigate to /var/www/
and create a text file named test.php which contains:


Now type in your browser:
localhost/test.php

You should see a large table of values that tell information about your server and php setup.

TESTING PHPMYADMIN
Open up your browser and type:
localhost/phpmyadmin

If you are taken to a login screen you can now login and create databased for your sites.