You want to test your website at your home and before setting it up on a real server ?
You want access your home machine from outside ?
You want to stimulate a real web site without loosing a penny ?
You have a decent connection and lot of time to test things out ?
Lets setup a home webserver with dyndns , ddclient and nginx
Overview
- Setting up a subdomain that points to your machine
- Setting up a Update Client ( using : ddclient )
- A basic webserver installation ( using : nginx since it is really light on system)
Requirements
- An ubuntu machine ( You can install any other Linux distro you are comfortable with)
- A working stable Internet connection
- Dyndns account ( You can get a free one from http://dyndns.com )
Installation & configuration
Step 1
Dyndns account registration and subdomain setup
a. Register a dyndns account ( http://dyndns.com )
b. login to the account
c. setup a subdomain , you can do this as below
My Account >> Add Host Services >>
Hostname : Select a domain and provide a hostname ( this will be used to access your home machine )
Service type : Host with IP address
IP address : Click on the link “Your current location’s IP address is x.x.x.x”
Select services and devices you would like to use with this hostname : webserver , ssh
Add to Cart >> Next >> Active services
Step 2
Install ddclient
yo@home:~$ sudo apt-get install ddclinet
You will be asked to configure it you can read and update the values as you like for now, as we will configure it manually with the below given steps
Step 3
Configure it by modifying conf files /etc/ddclient.conf and /etc/default/ddclient as below. Read the comments in the configuration file to get an idea of each directive. Please note to change the fields that are highlighted with your values.
root@home:~# vi /etc/ddclient.conf
# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf
## ddclient configuration file
daemon=300
# check every 600 seconds
syslog=yes
# log update msgs to syslog
mail-failure=Your_mail_Id@domain.com # Mail failed updates to user
pid=/var/run/ddclient.pid
# record PID in file.
## Detect IP with our CheckIP server
use=web, web=checkip.dyndns.com/, web-skip=’IP Address’
## DynDNS username and password here
login=Username
password=password
## Default options
protocol=dyndns2
server=members.dyndns.org
## Dynamic DNS hosts
your_sub_domain.domain.com
root@home:~# vi /etc/default/ddclient
# Configuration for ddclient scripts
# generated from debconf on Sat Sep 4 10:15:24 IST 2010
#
# /etc/default/ddclient
# Set to “true” if ddclient should be run every time a new ppp connection is
# established. This might be useful, if you are using dial-on-demand.
run_ipup=”false”
# Set to “true” if ddclient should run in daemon mode
# If tis is changed to true, run_ipup must be set to false.
run_daemon=”true”
# Set the time interval between the updates of the dynamic DNS name in seconds.
# This option only takes effect if the ddclient runs in daemon mode.
daemon_interval=”300″
Step 4
Install webserver nginx
yo@home:~$ sudo apt-get install nginx
Default DocumentRoot will be /var/www/nginx-default , you can upload your files to the DocumentRoot directory and you can access it from anywhere with your dyndns subdomain.