Creating Your Web Server

This topic was published by and viewed 3077 times since "". The last page revision was "".

Viewing 1 post (of 1 total)
  • Author
    Posts

  • Hooman Aminvand
    Participant
    • Topics - 11
    • @hooman

    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.

    VirtualBox_Ubuntu VirtualBox_Ubuntu

    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.

    nat_to_bridge nat_to_bridge

    After installation you must update Ubuntu and install apache web service and PHP by typing sudo apt-get update and sudo apt-get install apache2 php in the command line.

    Install_apache_and_php Install_apache_and_php

    Now, enter ip addr in the command line to show your server native IP address.

    ipaddr ipaddr

    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:

    Default_Apache_Page Default_Apache_Page

    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 cd /var/www/html then sudo rm index.html.

    apachefiles apachefiles

    Then, create a new html file by typing sudo nano index.html and put in your codes and then save and exit from nano editor by (Ctrl+X) and back to Web Browser and refresh the page.

    newhtml in Nano newhtml in Nano

    Apache_Test_Page Apache_Test_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.

    Port_forwarding_modem Port_forwarding_modem

    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: https://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 IP Address Your IP Address

    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

    SSH_into_webserver SSH_into_webserver
    Attachments:
    1. VirtualBox_Ubuntu
    2. Installing apache2 and php
    3. Change NAT to Bridge Adapter
    4. Default_Apache_Page
    5. ipaddr
    6. Remove apache index file
    7. newhtml in Nano
    8. Apache_Test_Page
    9. Port_forwarding_modem
    10. Your IP Address
    11. SSH_into_webserver
Viewing 1 post (of 1 total)