If you would like to set up a Web server to host a web site for personal use you can do so using your home broadband connection and a dynamic DNS service as long as you are not expecting to get numerous hits every day. If you are expecting a tonne of traffic then you will need a symetrical broadband connection. One very important thing to keep in mind is that when you install a web server you open your system up to traffic and hackers. I will be writing a future article on how to secure your system to avoid as many issues as possible.
Before we get into the meat and potatoes you will need DNS setup on your system. You will also need a domain name. You can get a free domain name over at DynDns.com Just remember to update your IP address over at DynDns every couple days or pay for an account and have it done automatically. You will also need to open and forward port 80 on your router to the computer on your network that will be running the web server. Your Debian system that will be hosting the web site should have a static IP address.
Change From DHCP TO Static IP On Debian
Edit the /etc/network/interfaces file. When you are finished your file should look like the following:
Now we must setup and configure port forwarding on our router to send all web traffic requests to port 80. We can accomplish this by doing the following:
Launch a terminal and type the following to install Apache. apt-get install apache2 After the installation process is finished, Apache will start automatically and it will start automatically when the system is booted. If you would like to know if Apache is working just launch a web browser and in the address bar type in the IP address of your Debian box. For example type in http://192.168.1.109 You should now be looking at a page that says It Works. The page you are looking at is the default index.html file that resides in /var/www/index.html. You can now populate the /var/www directory with pages of your new web site.
If you wish to change the defaults for Apache, the configuration file is located in /etc/apache2/apache2.conf.
Next, we need to edit the defualt configuration file in the sites available directory with our email address. To accomplish this do the following:
If you would like Server Side Includes installed do the following:
One more thing to do and we are done. Many of Apache's error pages have a footer with a horizontal line with text like the following: Apache /2.2.16 (Debian) Server at www.seowebz.com Port 80 Obviously we do not want this line included so we should omit it from the security file located in the conf.d directory. We can do this by typing the following in a terminal window: nano /etc/apache2/conf.d/security Look for these lines: