This topic was published by Hooman Aminvand and viewed 679 times since "". The last page revision was "".
- Topics - 11
In this tutorial, we show you how to create a web server with your Personal Computer. Then, you can upload your files in to your server via FTP, remote access by ssh, and has your website. In this article we use Virtual Box and Ubuntu minimal.
Before you Boot Ubuntu from ISO file or disk Right click on Ubuntu name (when add ubuntu) then settings/network and in the section ‘Attached to’ change "NAT" to "Bridge Adapter" its gives native physical MAC and IP address to your Ubuntu.
After installation you must update Ubuntu and install apache web service and PHP by typing
sudo apt-get updateand
sudo apt-get install apache2 phpin the command line.
ip addrin the command line to show your server native IP address.
In the above picture, you can see my ip (red). Now, open a Web Browser in your main Operation System and enter server IPs in URL:
If you have seen a page like that, it means your server is ready. Now you can edit web page file in /var/www/html. First, go to this directory and remove index.html by typing
sudo rm index.html.
Then, create a new html file by typing
sudo nano index.htmland put in your codes and then save and exit from nano editor by (Ctrl+X) and back to Web Browser and refresh the page.
Now you should config your modem\router to make your server public. Go to your modem settings with web browser and search for the "Port Forwarding" option in the NAT. If you did not find it, search on the Google by your modem model.
If you see "Application" option choose HTTP_Server (or like that). Otherwise, for manually set all options about ports to 80 (because 80 is for HTTP). Then in the "local IP address" Enter your server IP (that we seen with ip addr command) and Apply settings.
Now you need to know your External IP Address. You can see it here: http://dcjtech.info/what-is-my-ip and copy this to your Web Browser! The external IP address is from your ISP.
NOTE: Keep in mind if your external IP address is not static after each modem reboot. The ISP may give you a new dynamic IP address. There are two ways to make your dynamic IP address static (just search in Google).
Your web server configuring has been complete. You can use Filezilla to transfer your data between main OS and server. Also, you can control the server remotely by using ssh.
ssh USERNAME@SERVER EXTERNAL IP ADDRESS