Now learn how to upload your files and finally view your web server from anywhere in the world!
Now that our server is functional, we have to take care of the part where we can actually use it. Basically we need to expose the server to the outside world, so from here on out it is important to keep the server up to date with all of its patches – the Ubuntu Update Manager will take care of this for you.
Finding The Server’s Local IP Address
First thing you need to do is to find the server’s local IP address and set it to something you will later be able to reference. Let’s find the server’s currently set IP address – found via the dynamic DHCP protocol – in the Network Information box.
Right click on your network connection which will be an up/down array and go to “Connection Information.” This will pop up a box with your current IP address, network adapter card, broadcast address, gateway, and DNS server. Write this down as we will use it in the next step.
What we need to do is edit your connection information to give you a static IP address on your local network. Right click that menu but this time go to “Edit Connections.” Select the adapter name from the previous step – in my case it is eth1, and edit those settings. Select the IPv4 tab and switch “Method” to “Manual” rather than “Automatic (DHCP)” which is what it defaults to when you install. Type in the information from your connection settings.
The one difference we will have this time will be your IP address. Keep the first three octets (the numbers between the dots) and change the last one to a high number under 254. It is important that this number not be in use on your network, and if you are not sure, pick a high IP address like 250. For our example I know that .10 is free, so let’s say our new IP address is 192.168.2.10. This will be your static, local IP address.
Sharing The Web Folder
Sharing a folder is probably the easiest way to access and upload files onto your server. However, and this is a big one, this also opens your server up security-wise and it is important to only use this method if your server is on a private network and you do not run the risk of anyone connecting to it, via wired or wireless, and accessing your shares.
First we need to relax the permissions on our web folder. Open a terminal by going to Applications->Accessories->Terminal. Enter the following command:
sudo chmod 777 /var/www
It will prompt your for your password and then change the permissions, which will have no message returned if it went successfully.
Now go to the file browser (Places->Computer) and go to File System->/var/. Right click the www folder and then “Sharing options.” Check off “Share this folder“. For security options, you can either share it with or without a password. Select “Guest access” to share the folder without requiring a username and password.
This means that you or anyone else will be able to access the files without a password. For this reason, I recommend sharing with a password. It will be more of a pain because you will need to enter this information, but it is certainly more secure. Also check off “Allow others to create and delete files in this folder.” This allows write access from the shared directory.
To view your files, go to the network location //192.168.2.10/www. It will either prompt you for your password or allow you access straight to your files, depending on your security settings. This is the same set of files that you can access in your web browser by going to http://192.168.2.10/.
Now that we have our IP address, an important concept to understand is port forwarding. Every single person connected to the internet is behind an IP address. For most home connections, and also some business connections, the IP of your local computer is not actually exposed to the internet – it will be in a private range that is either 192.168.x.x or 10.x.x.x. So how do visitors to your website actually contact your server? We do this with port forwarding.
Ports on a server are similar to doors or windows on a house – each one will give you access to a different service running on the server. Web servers use port 80 by default.
Your router should have a section called “Port Forwarding“, or “Applications” which will allow you to forward ports properly. Forward TCP port 80 to inside your network on the IP address we specified above. Each router is different, so refer to your router’s operations manual on how to set this up properly.
Getting A Static Hostname
Most home connections have what is called a dynamic IP, which means that it will change after a set period, usually a week or so. We have covered the fantastic DynDNS server here on MakeUseOf last year, so check out that article for more information on using the DynDNS service. Make sure you use the Linux client for updating your dynamic IP with the DynDNS servers. For our web server you will want to forward TCP port 80. Forward this port to the local static IP address, in our case this is 192.168.2.10.
You should now be able to visit your web server from the outside world by going to the URL: http://yourhostname.dyndns.org. Some ISPs will block port 80 to your router. In this case, forward something like port 8080 to port 80. This will allow you to visit your website by going to http://yourhostname.dyndns.org:8080.
The World Is Your Oyster
That is it for our down and dirty guide to running your own web server on an old computer. It can be as simple or as complicated as you want and there are many variables thrown into the process so it is easy to get caught up on something. If you run into any problems, feel free to leave a response below and we’ll guide you through the process as best as we can.
Now that your web server is set up, you can focus on programming or installing your own software!
Reference site url:http://www.makeuseof.com/