Topic Title: Running one's own web server
Topic Summary: How to set up your own web server
Created On: 03 December 2011 12:47 PM
Status: Read Only
|Linear : Threading : Single : Branch|
03 December 2011 12:47 PM
Joined: 16 December 2008
I have recently been teaching myself XHTML and also the principles of CSS. My goal is to construct my own fully functional website on my own web server.
I understand that a web server requires software such as PHP and mySQL. I have attempted to read a number of articles and books on the matter of websites, servers and the associated software but they all seem to introduce terminology on an ad hock basis and I find myself floundering. I like the idea of running my own solid state web server for the following reasons:
1) Lower power consumption - taking into consideration the requirement of 24/7 operation.
2) Higher reliability - no moving parts as with servers containing hard drives.
3) Easier to incorporate power backup in the case of mains failure.
4) greater overall control.
My interest in this was sparked off ( or more accurately, re-ignited) by a constructional article in the December 2011 issue of the magazine Everyday and Practical Electronics, "Web Server in a Box".
This is a re-run of an article originally published in 2009 in the Australian magazine 'Silicon Chip', and so the idea of a solid state web server is not new. However, I only realized myself that a solid state web server was within the reach of the man in the street when I read the EPE article a week or two ago.
Having been an Incorporated Engineer for some time, (I am a former Broadcast Engineer) I am well used to teaching myself things such as circuit techniques and mathematics from a variety of books that are in my possession. I also have a post grad certificate in education ( I work in adult education) and am therefore into good pedagogy. However, I am having difficulty teaching myself web engineering due to the fact that the books and articles I have been trying to study do not seem to develop their ideas in what I would call a logical manner - they introduce too much too quickly and assume that you have all manner of previous knowledge and / or experience with this or that software and protocols. I had similar trouble a while back whilst I was attempting to tackle what appeared to be a non-specialist book on the history of the First World War. It assumed so much already-acquired background historical knowledge that I became lost quite early on into the book. I need to be able to juggle with one ball to start with, then two, and then three. With my current problem I feel as if I am trying to juggle with four or more balls at the very start !
Does anyone know of any books or courses on web engineering (I realise that it is a vast subject) that develop the material in a good logical and pedagogical fashion ?
04 December 2011 09:43 PM
Joined: 04 May 2009
Addressing your very last question first I can't really think of a single book that covers the whole subject because of the competing natures of the subjects that come up under your heading of "web engineering".
Really it comes down to which aspect you want to understand - do you want to understand the hardware engineering of constructing a server, or do you want to understand the setup, optimisation and management of the operating system that sits beneath the webserver program ? Alternatively do you wish to understand the webserver program and how it interacts with the world itself, or do you wish to understand the various nuances of TCP/IP and the upepr layer protocols that the web uses to transmit information ? Then of course there is the markup languages, predominantly HTML and XML that define the web pages, and the scripting languages that allow you to make more interactive content such as PHP, ASP and things like Flash. Finally don't forget the database engines like MySQL and MSSQL that store a lot of the backend information the web pages use.
As you say it's a huge subject so first up you need to decide what you mean by web engineering and then narrow in on books on that subject. Let's assume you have no particular desire to understand the hardware right now and that you're also not interested in the inner machinations of TCP/IP and what's required to support the internet infrstructure that transports web traffic then a good place to start would be looking at books on LAMP.
LAMP stands for Linux (OS), Apache (webserver), MySql (Database) and PHP (script language) and it is one of the most commonly deployed web server setups. There are quite a few books of this nature on amazon although I can't comment of how good any of them are - frankly most of the best references for this kind of thing are to be found on the web and there is absolutely no substitute for simply setting up a server and following the install guides for all the software. The best teacher for this kind of thing will always be experience.
Finally don't get too hung up on this concept of a solid state web server - there are actually some significant disadvantages using exclusively flash based storage in any kind of server applications [the write speed on some units is atrocious for example] and regardless of that magnetic storage is still an awful lot cheaper. Whilst lower power consumption can be a boon there are ways to minimise power consumption with regular systems [for example booting from magnetic storage into a ramdisk and running the server from there spinning down the magnetic storage until required]. At the end of the day, however, a server is just a specialised PC and a solid state webserver is just the same PC with a low power processor so that fan cooling isn't required and an SSD in place of the normal magnetic disk [a USB memory stick can serve this purpose on most modern machines for low performance requirements!].
Get to grips with the LAMP stack and you'll understand what you need from the software PoV to run a web server to host your pages. I wouldn't worry too much about the hardware or TCP/IP parts of it for the time being - just treat those as black boxes that do what you need them to do, remember that to host your own server outside of an expensive colocation facility you'll need some kind of static ip address [or a dynamic dns service] on an ISP that doesn't mind you hosting servers which can sometimes be a problem.
Jake Greenland, CEng MIET.
05 December 2011 07:45 PM
Joined: 23 June 2008
Think about the running cost of your server. If you intend to operate the server commercially it does not make economic sense to run your own server on your own premises. A basic x86 PC is about 300VA thus 0.3kVA * 24 * 365 = 2628kVA/hr (units) @ 10p = £262.80. This is a fair few pints of beer for 24/7/365 web server! Obviously less power will save you money.
Ideally you'll need a Static IP on your (assume) ADSL. This is about £5 a month [BT]. I know you can get it cheaper but needed to point this out. Also you upload speed will be limited, probably to 512kbps. More than 10 users and it'll be less than dial up speed for your users!
A basic virtual host is about £40 a year.
From your post I can assume you "just want to know" rather than "i need to know".
Irrespective of which operating system you choose to learn "how to" on, it's not easy. Then again if it was easy, we'd all be doing it!
Knowledge of TCP/IP v4 & v6, HTML, XML, CSS, PHP, A Records, MX records, ASP, Cookies, JScript, VBScript, .NET, Linux, Apache, Exim, MySQL, Firewall (IPTables), Network Routing, Nodes, HTTP, NTP, UDP, HTTPS, Network Ports, Perl, java, virtual machines, concurrency, transactions, ad nausuem...basically any software technology of the last 25 years, will be helpful but not essential!
Simply put you need a domain name (DNS provider), hosting and a website.
Lesson One - Domain name & DNS
All of these require an address where anyone in the world (unless your country, internet-service provider, network provider, etc. decides you are not allowed to see it) knows where it is.
Your domain name is your unique verbose address. There is a type of web service, called DNS, that resolves domain names to actual zero-and-one "physical" addresses. This can be likened to the postcode and your address. Every UK "address" has been given a unique code which can be looked up to find the Actual address.
Self-hosting is what you are proposing to do. I would strongly advise that you at least use a domain name provider to register your domain name and for them to hold the DNS A records for your domain name. This costs about £10 per year. There are loads of domain name providers. If you get pretty serious you could get what's called a Static IP address. I would also research Dynamic DNS providers as well which can save you money. There are good and bad, the good and bad depend who you speak to. Find one that works for you. I use Easily but you don't have to.
Lesson Two - Hosting
Hosting (Having) a website can be:
on a hosted server;
on a virtual hosted server;
You are proposing to be self-hosting. This means you need to build a webserver (the whole point of your post). Minimum is:
1 - Any x86 PC with two network cards (I prefer one network, one ASDL(?) (oh yes) trust no-one!)
2 - I would suggest you buy Red Hat Linux 9 Bible (Christopher Negus) ISBN 0-7645-3938-8 (or whichever flavour he wrote about last! ). Best £33.95 I've ever put on expenses. (IGL - Best 1p you'll ever spend on Amazon N.B. Other booksites are available!)
Lesson Three - Website
Where do you start? Gosh. You could do it in a text editor:
However I feel the best "learning tool" is (get ready to cringe) MS Visual Web Developer 20xx Express. It's free and it just works for "simple" websites, HTML/CSS based anyway. You don't need to use MS technologies.
Then learn about client side scripting (JScript/VBScript).
Then learn about server-side PHP\ASP scripting.
Either learn by server to website (1-2-3) or website to server (3-2-1).
My suggested learning path for you is:
Learn about websites - Registering a domain name; HTML\CSS on a virtual hosted server; PHP on a virtual hosted server.
Set up your server - (The book I mentioned will give you a lot of this knowledge or be a good initial reference to spring board from.) Setting up a "locked down" minimum Linux installation; Mounting and ISO Package installations of Linux deamons: dhdcp, iptables, squid, apache;
DNS - Dynamic DNS & DNS A Records.
Once you've grasped the "basics" above, the world's your oyster, literally!
Ian Lowson MIET
Do or do not, there is no try!
Edited: 05 December 2011 at 09:04 PM by lowson_i
FuseTalk Standard Edition v3.2 - © 1999-2015 FuseTalk Inc. All rights reserved.