How do you run multiple web-servers on a single ip-address?

How does one run multiple websites of a single IP Address?

One way to do this is to use a server running Squid. The idea is that you point the router to go to the computer running squid when a request comes in for port 80. You then have to configure Squid to act as a ‘reverse proxy server’.  When I first did this I used Squid 2.7, so what I am about to write relates to that version of Squid. So follow the Wiki, or one of the tutorials on the internet, for installing Squid. The bit I found not well explained was the actual settings required in the Squid config file. So here is a way to look at what is needed.

The first bit is to set the server to service port 80 requests coming in from the router.  Use your favorite unix system editor to edit the file /etc/squid/config file. Locate the line containing the field ‘http_port, and change it to

http_port 80 accel vhost

Lets say your website server behind the router firewall  is called ‘websiteserver1’ and its on an LAN address of  Then you need the following two lines in the Squid Config file:

cache_peer parent 80 0 no-query originserver name=websiteerver1

Now you need to create a record that specifies all the websites that you want webserver1 to accept. Lets say the record for websiteserver1 will be called sites_webserver1. and the urls relating to that record are, , and Then the following line is required:

acl sites_websiteserver1 dstdomain

Now we need to specify the configuration for the cache that Squid will require. This is done using the line:

cache_peer_access websiteserver1 allow sites sites_websiteserver1

Finally you need to let Squid now which websites it is supposed to handle. This requires the line:

http_access allow sites_websiteserver1

Make sure that the last line in the http_access is:

http_access deny all

This last line ensures that all websites not in the list preceding the ‘deny_all’ will be the only sites that Squid will accept.

If you have done this for a number of website servers, say three of them, you should have a set of lines that looks something like the following:

cache_peer parent 80 0 no-query originserver name=websiteserver1

cache_peer parent 80 no-query originserver name=websiteserver2

cache_peer parent 80 no-query originserver name=websiteserver3

acl sites_websiteserver1 dstdomain

acl sites_websiteserver2 dstdomain

acl sites_websiteserver3 dstdomain

cache_peer_access websiteserver1 allow sites_websiteserver1

cache_peer_access websiteserver2 allow sites_websiteserver2

cache_peer_access websiteserver3 allow sites_websiteserver3

http_access allow sites_websiteserver1

http_access allow sites_websiteserver2

http_access allow sites_websiteserver3

http_access deny all



Adding or removing a command in Linux

So where do you add an instruction you want to run on startup in Linux? Well, it depends on when in the bootup-startup process you want it to run. If you want it to run just as it is initialising the gui (X11) then the best way is to create a file called ‘autostart’ in your /home/username directory. Then go to the script that controls the startup script for X11 and add the autostart file to that script.

As of 2016 you will find the startup script at:


Go to the bottom of this file and insert the instruction:


This instruction will now cause the lx sesstion to run the startup  script in your home directory. Now go to your home directory and create a file called autostart. In this script add the command line you would like to run. For example if you want to run a http server at startup, you can add the line:

@python SimpleHttpServer 80

in that scrip.

Now, whenever you want to add a startup script to your system you don’t need to go hunting around the internet finding all those misleading tips—rather the startup script is right there in your home directory.

Changing the name of a linux system

So you want to change the name of a computer that is running Linux. Simple?
NOT… nothing is straight forward in Linux. Sure lots of programmers and IT developers will swear by Linux, but that doesn’t mean its straight-forward and neither is the documentation so spectacular either. Because so much of it is open-source you find all sorts of contradictory advice around the internet, and often it’s wrong anyway. So here is my attempt at contributing some consistency as I develop a few tutorials around some often encountered tasks.

This one is where you want to change the name of your Linux system so that when you look at your Local Area Network you will see the name of the computer rather than an IP address.
First you need to go to the file /etc/hosts. There you need to add (or change) the line

hosts yoursystemname

Then you need to edit the file /etc/hostname and change the name to


Newton’s Cannon — where it all started.

Much of our thinking about gravitation has its origins in Isaac Newton’s thought experiment about firing a projectile from a high mountaintop at various speeds. If you are mathematically inclined you could read his Treatise of the System of the World.
However, today with our computer technology it is possible to simulate the dynamics of his equations and watch them run in real time.
Feel free to pick a speed for the cannon ball in the slider and then click on the ‘fire’ button to see what happens for different speeds. Click on the ‘clear’ button to clear the trails.

Canvas not supported Canvas not supported; please update your browser.
Initial speed = 3000 m/s

You will notice that up to 7000 metres/second the projectile falls back to the Earth. As you approach 7000 metres/second the curve of the trajectory approaches the curvature of the Earth. At 7100 m/s and above the projectile misses the Earth and so goes into orbit–a radical thought for someone to have in the mid-1600s.

For more orbital mechanics click on Orbital Mechanics.

This simulation is based on Daniel Schroeder’s excellent tutorial on physics simulations using html5.


Are we really in a Cave?

Is justice simply following the laws laid down by those in power? Or is justice defined by God or Gods? Or does justice eminate from some underlying principles of the universe (like the laws of geometry or physics)?

In Plato’s The Republic, Socrates discusses this issue with some friends on a balmy afternoon two and a half thousand years ago.  As the discussion unfolds Socrates comes to the conclusion that one cannot simply rely on examples of justice in practice because there will be good and bad examples that succeed or fail for the wrong reasons. Therefore, Socrates argued,  we need to look at the principles behind the forms of justice that we see. Socrates then expounded on his allegory of “the cave”. Without light we cannot see anything. But light does two things, it illuminates solid forms, but those forms also cast shadows. What happens if people mistake the shadows for the forms? Socrates goes into quite some detail to explain how people might mistake forms and shadows, and that there are forms for everything, including the ideal form of justice. Since there is an ideal form for justice, it also has a shadows, the imperfect execution of the ideal form of justice.

What if we are all like prisoners, said Socrates, and we are chained to a cave wall facing away from the opening of the cave and there are forms outside the cave that we can’t see? The light would enter the cave  from behind us and we can only see the shadows of the forms outside the cave. We will almost certainly mistake the shadows for the actual forms. But what if a man were to break free from the wall and climb outside and into the bright light and see what was out there. He would initially be blinded by the light, but as his eyes adjusted to the brightness he would start to understand what is really going on, the objects outside are casting shadows into the cave and he now sees quite clearly how what he thought was reality turns out to be only a small part of the real world. Excited about his discovery this man rushes into the cave to tell the others. But two things happen. His eyesight will still be adapted to the bright light and inside the cave will appear to be pitch black and he will stumble around. The other thing that will happen is that his cave-friends will scoff and jeer at him and they accuse him of being drunk or insane.

So why was Plato, through the character of Socrates, talking about caves and shadows and forms? Well back then they saw it as the job of the leaders to become educated about the ideal forms and lead the population out of the metaphorical cave, and that is why they discussed this in The Republic. In its ancient form this allegory may seem a little strange to us today. Perhaps it meant something more to the ancient mind, and today it has lost something in the translation. But there are historical examples that we may find that might make the allegory clearer for us.

So let us fast-forward by 2000 years to the 1500s. Galileo has been looking through his telescope and he sees that the Moon has large mountains  and huge flat areas that look like seas. He turns his telescope towards Venus and sees it has phases just like the Moon, and he looks at Jupiter and he sees that it has  its own moons orbiting around it.  Over the months and years that he spends looking through the telescope he starts to for a rather strange picture in his mind of what the universe is like. Perhaps the Earth goes around the Sun just like Jupiter has moons that orbit it? Perhaps the Moon and the other planets are whole worlds, just like the Earth, and not just points of light? Wow!!! If you were on Jupiter and you looked out through your telescope towards the Earth you would see the Earth as we see Jupiter. From Jupiter you would see the Earth as a crescent illuminated by the Sun with one moon going around it! Wow!! It is as if he had clambered out of the cave that everybody else was in and been exposed to a bright light. He could never return to that small Earth-centered view that everyone held back then, he had been exposed to where we really are in the universe.

But Galileo realized that there were many problems with his new-found perspective. For example, if we are on a planet that moves like the other planets and the other moons, why don’t we feel that motion? To argue that we orbit the Sun would only draw arguments from his peers and the public that we feel no motion. But worse, why don’t these other worlds come crashing down on us?  All that Galileo’s raw observations had done was to raise more questions than it answered. Observations were clearly not sufficient to convince anyone, the new perspective needed new knowledge that would enable people to make sense of what had been discovered by looking through the telescope.  Unfortunately for Galileo, the issues relating to the principles of  gravity would not be resolved satisfactorily until Newton came along a hundred year later.

However, Galileo started thinking about gravity and was somewhat troubled as he did. For example, everyone can see that heavy things fall faster than light things, right? Just drop a feather and a hammer and see which falls fastest….it’s clear…isn’t it? But Galileo knew that things are not always as they seem and he pondered this question further. So here is a simplified version of Galileo’s thought experiment about gravity.

Imagine a bowling ball. Bowling balls are pretty heavy. If you were to climb up a tower and drop a bowling ball you could use your stop-watch to measure the time it took for the bowling ball to fall to the ground.  Now you go to the bottom of the tower and pick up the bowling ball you just dropped and take it to your work-shop and saw it into two pieces, say into  2/3rds and 1/3rd.  Now climb up the tower and drop the two pieces of the bowling ball one after the other and time the time they take to reach the ground with your stopwatch again. What would you expect if heavy things fall faster than light things?  Well both pieces should take longer to fall to the ground than the whole bowling ball, right? In fact, you would expect that the whole bowling ball would take the least time to fall to the ground, the 1/3rd piece would take the most time to reach the ground and the 2/3rd piece would be somewhere in the middle. Right?

Ok so now you pick up both pieces and go to the top of the tower again. Now what you are going to do is tie both pieces of the bowling ball together by a piece of cotton thread. You hold the two pieces of bowling ball next to each other and drop them together. What does your theory predict?

If heavier things fall faster that light things, you would expect that the 2/3rd piece will fall slower than the whole bowling ball, but faster than the 1/3rd piece. At some point during the fall the cotton thread might become taught. Your theory now predicts that there will be a tug of war between the two pieces of the balling ball as the 1/3rd piece tries to tug the 2/3rds piece upward and the 2/3rds piece tries to tug the 1/3rd piece downward. Presumably the two pieces will fall at some average speed of each of the two separate pieces. In fact, your theory predicts that the speed of the two pieces attached by a cotton thread will reach the ground some time-interval less than the 1/3 rd piece but greater than the 2/3rd piece.

But what if we made the cotton thread shorter and shorter over a number of repetitions of the experiment, until the pieces of the bowling ball were tied together so close that they may as well have been the whole bowling ball. Should the two pieces fall at the same rate as the whole ball? Or slower, as if attached by the thread? And why should the length of the cotton thread make a difference? Clearly this is nonsensical!

So if we start out with an assumption and follow a good logical process and find that we reach a nonsensical result, we must go back and re-examine our original assumption. In this case the assumption was that heavy things fall faster than light things! But if we discard the assumption that heavy things fall faster than light things, what are we left with? No matter how counter-intuitive it seems, we are left with a starting assumption that all things must fall at the same rates!! And this is why Galileo went out dropping heavy objects from towers, to test the result of his thought experiment–that all things fall at the same rate.

Notice that what Galileo was doing was putting logic first and experimentation second. Experiments were at the service of logic. That is, Galileo spent considerable effort examining the underlying principles of the universe first and then checking the outcomes of his thoughts with actual experiments to make sure that his starting assumptions were valid. In modern philosophical terms we might say that Galileo’s thought experiment was deductive, and his experiments were inductive. Deductive meaning thinking abstractly and looking for general principles from which we could understand specific phenomenon. While his experiments were inductive, because the specific trials were used to point at the more general principles. Modern science has been built on Galileo’s method of using deduction and induction together to build up our knowledge.

And Galileo was building on Plato’s idea of forms, that you must look for the underlying principles (the forms illuminated by the light) and not be seduced into leaping straight into believing what you see (confusing the shadows of the forms with the forms themselves).

So what did Plato predict would happen when Galileo went out enthusiastically pronouncing his discoveries?  Indeed those in power at the time, it happened to be the Pope and the church back then, thought Galileo was insane. So fearful were they of what they considered to be  Galileo’s flawed logic that they locked him up to keep him from harming others minds and in an attempt to silence him they accused his writings of being heretical and banned them.

What did Galileo say about all that? “Wisdom is written in that great book–I mean the universe–which stands continually open to our gaze, but we cannot understand it unless we first learn the language in which it is written. This book is written in the language of mathematics, and the symbols are triangles, circles and other geometrical figures, without which it is impossible to comprehend a single word of it. Without this language one is wandering about in a dark labyrinth”. (Quote attributed to Galileo from The Assayer, 1623, Thomas Salusbury) Doesn’t that sound like Plato’s allegory of The Cave?

Perhaps Galileo had read  Plato’s The Republic, or perhaps he hadn’t,  we can’t be sure. Even so, Galileo’s method for acquiring knowledge was predicted as being sound by Plato. So to, unfortunately, Plato had predicted the public’s reaction to ground-breaking knowledge–Plato’ prediction is not good, but perhaps if we take heed of the lessons in history we may do it better in the future.

Time for a pause

Taken by William Anders on December the 24th 1968, this image was described by Galen Rowell, the famous 20th century nature photographer, as “one of the most influential images ever taken.” But why should this photo be so influential? Arguably, many people might say that it shows the totality of humanity as viewed by another human for the first time. Three humans behind the camera, three and a half billion being photographed and nothing beyond.

However, I ask rhetorically, why is that important?

I have pondered that question since I first saw the photograph  and it hung on my bedroom wall for several years while I was a teenager. I do not believe that I fully appreciated the photograph back in those days, but I believe I see it in a different perspective now.

When one becomes frustrated, or annoyed, or if someone is irritated by the actions of another, when a politician, president, monarch or person in power is about to take action, perhaps this image may come to mind. And when it does, perhaps the image may cause a person to hesitate for a second, or perhaps two, or even maybe 10 seconds. In that pause something important is happening, and that is the opportunity for a little wisdom to step in. You see, before someone decides to take action against someone else then maybe this image haunt them and cause them to reflect for a moment. They may then remember that all of our failures, low points, and conflicts, and all of our successes, high points and global collaborations have all occurred on this tiny spaceship we call Earth. And so as a person of influence is about to decide on their course of action, maybe they will remember where they are and for a moment allow a little wisdom to enter their thoughts before they make a decision. If that were to happen seven or eight billion times around the Earth then perhaps there might be some hope for the longevity of life on Earth.

Still coming to grips with hosting a wordpress site

Isn’t it great when it all seems to work, the site has been up and running for a few weeks, 24/7, and I think I’ve even figured out how to post the blogs. Then comes a period where I have to travel. That day a truck runs into a trunk line and the internet goes down. After a couple of hours a frazzled IT support person returns my tech-support enquiry, “no nothing wrong we can see your modem”. So I recycle the modem and we’re back on line. But I have to leave to catch my flight. That night from my hotel room I pull out my lap top to check the website—nothing.  So I check the DNS website, and my IP address hasn’t updated all day. I check it the next day, nothing again. No IT support person to ring, because the IT department is me, and I don’t have any way of recycling the modem or the Raspberry Pi (the hosting hardware for my website). Clearly I need to rethink how I might get around such a problem. But then again, how often does a trunk line get severed? Well, it’s the second time in two months. Perhaps I need a new ISP.

Coming to grips with Word-Press

I’m still coming to grips with Word-Press.  I can see what the originators are trying to do, but I don’t find it particularly intuitive–although that may change as I get more experience with it. For example, Word-Press asked me to write my first blog. So I am writing one, but I don’t know where exactly it will turn up and what the result will look like. Once this is posted I will be able to go and look at the pages and see that the result is. But from where I am now, I have no idea. So here goes, terminating the writing and going to see…