Turn your Ubuntu machine into a webserver [Published]

edited August 2011 in Tech & Games
Turn your Ubuntu machine into a webserver

Turning your existing Ubuntu installation really couldn't be simpler, and if you're looking to get into web design or development then this might help.

1. Installing Apache

Apache is webserver software which will allow you to host all your files on your computer, letting you or anyone else view them in a web browser. To install Apache, run this command...

sudo apt-get install apache2

2. Installing php

Assuming you will be wanting to work with php when designing your site, you're also going to have to install php. This step isn't necessary if you're not looking to use php, but I'd recommend doing it anyway, just in case you might need it in the future.

sudo apt-get install php5

3. Accessing your www directory

Your www directory is where you will place all of your webpages and directories. This folder can be accessed by browsing to the following location...

/var/www

4. Opening up port 80 (HTTP) to allow others to view your site

If you would like other people to view your site, you will have to allow incoming requests on your HTTP port. Go into your router's configuration pages, and add an exception to the firewall. The way you do this is different for most routers, so read the manual before doing it.

5. Add your webpages, and view them in your browser

All you need to do now is add pages to your www file. Create a file using a text editor of some kind. My favorite on Linux is Scite, which is very similar to Windows' Notepad++. To install Scite, run the usual command...

sudo apt-get install scite

When you have your index page, browse to your localhost (try this if that doesn't work) to view your website!

If you want to show a friend, head over to WhatsmyIP, and send him/her your IP address. He can then put this in his browser, and view your site.

Enjoy!

Added to CMS by Trx100

Comments

  • SlartibartfastSlartibartfast Global Moderator -__-
    edited December 2010
    :thumbsup:

    If you don't have a static IP, you can hook it up to dyndns. It runs a daemon in the background that updates a hostname with your current IP. They offer free ones like : ' username.dyndns.org '

    Some modems can do it for you.
  • edited December 2010
    Thanks for the input bro. Anything else I could add to this guide or is it all good? I'm going to make a guide for people running Windows as well, I think.
  • PacinoPacino Regular
    edited December 2010
  • edited December 2010
    Are you confused about something or are you just posting cool drink commercials in my thread? (I love that drink, BTW).
  • PacinoPacino Regular
    edited December 2010
    i am confus :(
  • edited December 2010
    Well, can I help you with anything?
  • DfgDfg Admin
    edited April 2011
    Taken from: Everything *NIX
    CMS Status:
  • RaggedOldManRaggedOldMan Regular
    edited August 2011
    Thanks for this guide, I used it when I was setting up my own webserver for testing purposes. I enjoyed reading it, all except for the fact that it was a littled mashed together. It needs to be formatted a little better so you can distinguish the shell commands from the rest of it. I seem to remember in your other guides that you put your commands inside a code box? I think you should do that :)
  • DaktologistDaktologist Global Moderator
    edited August 2011
    I have a file server running ubuntu which doubles as a webserver for testing. I installed samba as well so I could access the /var/www directory from my main machine, along with the file server directory. Makes things easier since the server lives in my ceiling space.

    EDIT. I used this guide; http://www.bit-tech.net/bits/2007/06/05/build_your_own_server/1, when i built my test server 5 months ago.
  • edited August 2011
    Thanks for this guide, I used it when I was setting up my own webserver for testing purposes. I enjoyed reading it, all except for the fact that it was a littled mashed together. It needs to be formatted a little better so you can distinguish the shell commands from the rest of it. I seem to remember in your other guides that you put your commands inside a code box? I think you should do that :)

    I'm glad that you found this guide useful, I don't even remember writing it! :D Thanks though, I'll add some code boxes in when I'm back at home. I can also update the CMS entry with the same formatting so that it's easier to read on both platforms. Thanks for your feedback :)
Sign In or Register to comment.