Creating Your Own Webserver and Hosting A Website from Your Linux Box

If you have any questions or problems regarding this article and want help within 24 Hours? Ask Now

Avishek Kumar

I am a major in computer science, love to research nix. I love to write codes and scripts, review distros, experiment Foss Technologies, write technical articles, Hack, of course Ethically. I am working as System Administrator (nix) for a NGO.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Receive Your Free Complimentary eBook NOW! -

Download Free Linux eBooks

Advanced Bash-Scripting Guide
Linux Bible
A Newbie's Getting Started Guide to Linux
Ubuntu Linux Toolbox: 1000+ Commands

You may also like...

43 Responses

  1. saurabh says:

    Hello Sir,
    I want to know if i host a website on my local ubuntu server 14.04 .how can i access this site externally !.What are the settings that need to be done for this?

    • Avishek Kumar says:

      1) it is not a good idea to do it host a website on local server.

      2) If you understand the risk, you can simply forward the port. All you need is a Static IP.

      You should be able to do it yourself by following the guide, if however you seek my help you may send me your ssh server

  2. Diego says:


    Thank you very much for your reply. Is this a suitable way to create a website in order for large amounts of people get there? I mean, is this going to work for a site with audio streaming, embedded videos, text, images, etc, being visited by lots of users? If so, what hardware would you recommend for something like that? Thank you!

    • Eric Sebasta says:

      That goes way beyond the scope of this, which is a testing server. Of course Linux can do what you are asking, 70% of everything served over the Internet came from a Linux server, across Linux routers and switches to you. ;)

  3. it was very useful post thnx a lot

  4. Luisa says:

    Hello I am trying to install MySQL and keep getting this error:
    E: Unable to locate package mysql
    I googled it and people said to do the command
    sudo apt-get update
    But still didn’t made it work.

    Thank you.

    • Avishek Kumar says:

      I fear you haven’t installed mysql. have you?

      what is the output of
      $ whereis mysql

    • Avishek Kumar says:

      and if you are unable to install mysql let us know what distribution you are using and its version.

      • Luisa says:

        Thank you very much for your reply!

        I did this in my console:

        root@ns357128:~# whereis mysql
        mysql: /usr/bin/mysql /etc/mysql /usr/bin/X11/mysql /usr/share/man/man1/mysql.1.gz

        Then tried to install like on your tutorial:

        root@ns357128:~# apt-get install mysql mysql-server mysql-client
        Reading package lists… Done
        Building dependency tree
        Reading state information… Done
        E: Unable to locate package mysql

        I installed apache and http://your-ip-address works, so I assume apache is installed.

        Then i tried to install PHP:

        root@ns357128:~# apt-get install php5 libapache2-mod-auth-mysql php5-mysql
        Reading package lists… Done
        Building dependency tree
        Reading state information… Done
        libapache2-mod-auth-mysql is already the newest version.
        php5 is already the newest version.
        php5-mysql is already the newest version.
        0 to upgrade, 0 to newly install, 0 to remove and 42 not to upgrade.

        So I assume PHP is installed, but I did the info.php and placed in the /var/www/html folder, but just appears a blank page so I assume I need mySQL installed?
        I did a better research so I also assume I need to isntall this: but I wanted a confirmation first.

        I am using kimsufi dedicated server OS Ubuntu Server 14.04 “Trusty Tahr” LTS (64bits)

        I am sorry for all the questions but I am really new to this and really want to install a forum in my dedicated server!

        Thank you so much for your patience.

        • Avishek Kumar says:

          send us a mail with your ssh login details or remote desktop login credentials and we will solve this for you.

  5. vishal says:

    Sir , i started to create a website after reading your article , but i’m successful in publishing my website upto my local network . but i want to make it live through out the web ( outside my network also ) . and i think i had static ip too , but i’m unable to make my site live for whole web . please help me

  6. thank you .it is very useful tuturial for installing LAMP Server

  7. Alejandro says:

    Which are the differences between ‘/var/www/html‘ and ‘/var/www‘?
    If i have created an html file with php on it, to be able to execute the file and see it on the browser where should i put my file?

    • Avishek Kumar says:

      Apache’s working directory in some distro is /var/www and in some disto /var/www/html.

      If you have html directory at location /var/www/, then it means your working directory is /var/www/html. Put you php file here. set up the correct file permission. and finally point your browser to

      Replace Php_filename with the name of your PHP file.
      Hope it helps.

  8. Pavan says:

    Hi Avishek,
    It’s nice to have this tutorial. Need information in detail. How can we access this URL using www. Need info about that setup
    Thanks & Regards

  9. Ananth S P says:

    Clear explanation.. just made it simple.. thank u

  10. dario d says:

    This was a great tutorial,thank you.This will help me to build my first web server and hos my websites.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Join Over 80000+ Linux Users
  1. 52882
  2. 2763
  3. 18,639

Enter your email to get latest Linux Howto's