Hosting your website on a local server
The content of your website need to be hosted somewhere. This somewhere is what we call a server. In fact the website you designed is intended to be seen by others. So the computer which will host the content of your website will have for mission to deliver the content of your website everytime someone or something will ask for it, those are what we call clients.
There are many ways you can host a website:
- You can host it locally, this is what we are going to see right now.
- You can host it on your own hardware and make it accessible on the internet, it requires a lot of expertise, so very few people are doing it.
- You can host it on someone else server and make it accessible on the internet, this is the solution that everyone is choosing (in fact you outsource it to expert companies).
How to host your website locally?
Hosting your website locally means that your website will be accessible only to the people and things which are within your network. So let's imagine that you create a website on your computer and that you are using a server software such as Apache, Nginx... then it means that all the persons within your network, so to say your family (the one using the same internet connection as you) will be able to connect to it. However, unless you allow your server software to make your website accessible from the outside, people from the outside won't be able to access it. In general you don't want to do it unless you have system administrator knowledge.
Ok, let's see how to install a local server.
How to install Apache?
Apache is by far the most populare web server software https://en.wikipedia.org/wiki/Apache_HTTP_Server.
In order to install it, you just need to run:
sudo apt install apache2
Once installed you just need to host there the content you wish and then it will be accessible to other machines on your network. In order to know to which IP address you need to connect to, just execute:
In general you need to put them within a folder named /var/www/ and you can access by typing localhost within your url address bar.
What is the point of installing a website on a local server?
The main reason is for testing purposes. Let's imagine that you would like to build a website but you don't want to disclose it publicly, then a local server will be very handy. This is as well very useful when you want to test new technologies. In fact
as you own your server entirely, you are free to break it. So for example you can install many technologies on it such as WordPress, Drupal, Matomo, Moodle or whatever other technologies which require a server to run.