How to setup a locally hosted webserver

05 March,2018

I could argue that knowing how to setup a webserver could be one of the most handy things you could learn how to do with a computer, especially if you work in any kind of IT type position. If you link the web server to the internet, you can set yourself up a website that could do anything you could need it to do. I have built web servers to take the place of thumb drives that you could store much bigger files than a thumbdrive could handle on, just as an example. In this tutorial I'll show you how to setup a webserver so if you ever have any kind of idea to setup your own for, you'll have the knowledge to know how to do so!

First you start off picking what kind of server you're going to use, which can either be a physical server like the computer you're probably typing on now, or a virtual server, which is what I'll be showing you how to setup in the tutorial. There's no real differences in the setup process once you get to the point of installing the operating system to the server. I would recommend you setup your web server using virtualization software, because a website server does not need a whole lot of resources. Virtualization means to setup a computer operating system inside of a computer's operating system. If you're going to set this up on your daily driver type laptop or desktop computer, I would recommend you use a program like Virtual Box, or VMWare Player. These programs allow you to virtualize an operating system inside your already running computer's operating system, so you can literally have a stand alone and segregated OS environment. This is handy for a TON of reasons, but today we'll be using it for our web server. I myself, will be setting up the web server in a virtual environment, but I'll be using the server version of VmWare Player called ESXi. If you're fortunate enough to have a separate computer you can treat as a server, that would be the best route. My server never actually turns off, and your laptop or desktop computer might need to turn off or restart from time to time. It goes without saying, but I will anyway, that if your computer turns off, your server virtualization will turn off too, and you won't be able to reach your website.

At the top of this blog page, there is a step-by-step video on how to setup the entire thing, starting from the point of installing the operating system to your virtual environment. I recommend using Ubuntu Server 16.04 LTS 32x version, because it's easy and the least most resource heavy for your system. The less amount of resources your system requires, the better it will run and the more virtualization systems (if you want to) you'll be able to run. The process from the point in which you're installing the operating system is pretty much identical across all the different type of virtualization programs you can use, so long as you're using Ubuntu Server 16 like I just linked to

Once your webserver is running and you can reach it using a local IP address, you'll want to setup your router to accept outside (on the internet) requests to your webserver. If you're only setting up the webserver to run on your own network and you don't want to be able to reach it from the internet, you can skip the rest of the tutorial and call it done. However, if you do, then you have the choice of either setting up port forwarding, or routing an entire dedicated public IP address to the web server. If you are going to run this to the internet and only have a single IP address available, something most consumer internet connections are subject to, then you'll be going with port forwarding. If you have multiple IP addresses then you can route a single IP address to your server. Either way works just the same, but if you plan to be allowing a lot of active connections to the webserver, like if you're running a blog or other type of publics website, then you may want to look into getting another IP address to let it run on by itself so your pipes don't get clogged with the extra traffic.

In the video tutorial I show you how to run it from a dedicated IP address, but port forwarding is much more simple to do. I have a video tutorial coming for that as well, which will be released in the next day or so.

Once your server is running, upload your website to it using a program like WINSCP and Putty. These programs allow you to SSH connect to your server and issue commands and upload and download files. If you're using Apache for your website program like we are in the tutorial, your website directory folder will be in /var/www/. So when your website is uploaded, that directory will look like /var/www/html/, /html/ being your website with the contents of your website being inside the /html/ file.

Once your website is uploaded, and your router is handing incoming connections, it's time to link a domain to the public IP address you have assigned to you by your internet service provider. Technically you don't have to do this part, and you can always get to your website using just the IP address. However, if you plan to encrypt your website with HTTPS, something we'll go over in a future tutorial, or if you want other people to be able to access your site, then you're better off getting it a domain. I use GoDaddy because it’s very simple to use. You can use any other domain registrar, and believe me when I say there are plenty more and a lot of them are better to use. So once you're purchased a domain, find the "manage DNS" button for it, and edit your "A" record with your assigned IP address. Then if you've done everything correctly, you should be able to reach your webserver's website whenever you type in your domain to your web browser! Congratulations if you've made it this far and everything is working correctly!

Having your own web server is a really awesome thing, and incredibly handy as well. If you get on skillshare or youtube to start looking up some basic HTML tutorials to start getting an understanding of everything that's possible, your mind will begin to go wild with ideas on everything you can do with your own personally hosted website. Anything you can think of to create is now yours to command and no one can tell you otherwise, because you'll own the entire thing yourself! If you have any really cool ideas or projects you'd like to share, shoot us a comment or a link to one of our social media profiles. We'd love to see what you've created! If you need any help or got stuck somewhere along the way, feel free to shoot us a message, we're happy to help you build your own little personal island on the internet!

Leave a reply

Your email address will not be published. Required fields are marked *