Linux Webserver

Discussion in 'Software' started by TobletDanillio, 7 Jul 2012.

  1. TobletDanillio

    TobletDanillio Minimodder

    Joined:
    7 Jan 2012
    Posts:
    379
    Likes Received:
    5
    A mate and I want to make a website we know very basic coding but this is not the issue atm.

    we get free space with Virgin media to make a website but you have very little space to store photo/videos we will use youtube to upload videos but we need more space for the photo.

    I have a spare pc which I'm thinking of installing Ubuntu Server. could this be used to store photos for the website?

    if so how?
     
  2. sourdough

    sourdough Minimodder

    Joined:
    17 Sep 2010
    Posts:
    123
    Likes Received:
    1
    You could actually serve the whole site on your server as your IP address from Virgin is fairly permanent. If you are not keen on that, how about storing the photos on Flickr?
     
  3. theshadow2001

    theshadow2001 [DELETE] means [DELETE]

    Joined:
    3 May 2012
    Posts:
    5,263
    Likes Received:
    176
    is there any reason you can't use online photo hosting sites in the same way you're going to use youtube for videos?
     
  4. TobletDanillio

    TobletDanillio Minimodder

    Joined:
    7 Jan 2012
    Posts:
    379
    Likes Received:
    5
    How would I do that this? that we want

    as they aren't very high quality
     
  5. lp rob1

    lp rob1 Modder

    Joined:
    14 Jun 2010
    Posts:
    1,530
    Likes Received:
    140
    What you are attempting to do is identical to what big companies do on major websites - divide the web and media hosting. For the computer, load up a copy of Ubuntu Server and put nginx on it. I wouldn't get the full LAMP stack (as in the installation stage) but just the web server. To do this, after installation is complete (and all updates are done!), run
    Code:
    sudo apt-get install nginx
    And press 'y' when it wants you to confirm.

    Your web root is at /usr/share/nginx/www, but you can easily change this by going into a text editor as root (eg. sudo nano) and editing /etc/nginx/sites-enabled/default, specifically the 'root' line in the 'http' section. The command to do this would be
    Code:
    sudo nano /etc/nginx/sites-enabled/default
    Ctrl-X to quit and save, and text insertion works as normal. A common web root is /var/www. Just make sure the permissions are set correctly.
    Code:
    sudo mkdir /var/www
    Now at this point, you have a perfectly good webserver, but you are probably wondering how you are going to get your files onto the server! SSH is your friend!
    So install openssh-server, using the same command as you used to install nginx, then set the following configuration options (using the sudo nano command above) in /etc/ssh/sshd_config:
    • Make sure PermitRootLogin is set to yes
    • Make sure PasswordAuthentication is set to yes (and uncommented - a comment is a # before the line)
    So the two lines should be:
    Code:
    ...
    PermitRootLogin yes
    ...
    PasswordAuthentication yes
    ...
    One last step - type
    Code:
    sudo passwd
    to set the root password. One thing to note - should anyone get hold of this password they can do anything to your server!

    Server-side done!

    On a Windows client, you will need WinSCP - port 22, username 'root', password the password you set earlier. On a Ubuntu client, you will need to go to the file manager, then File, then Connect to server, and enter in the same details. Both of these tools allow you to transfer those images to the server.

    Now just open up port 80, set the website to look at your IP, and you are rolling!
     
  6. TobletDanillio

    TobletDanillio Minimodder

    Joined:
    7 Jan 2012
    Posts:
    379
    Likes Received:
    5
    I have finished installing ubuntu server with all programs need and add some files in the /www so when I go to the ip address it come up with what I want but I have a few questions still

    I have two hard drive free in the pc and I want to move the /www to a spare drive so I have more space to put photos and videos on (YouTube isn't going to work the way I haoped). But I'm not sure how to move/copy /www to sdb1.

    Also I want to make the website have a login so that I can put stuff (photos and videos) on the second spare drive /sdc1. Does anyone know how I can do thing?
     
  7. Votick

    Votick My CPU's hot but my core runs cold.

    Joined:
    21 May 2009
    Posts:
    2,299
    Likes Received:
    102
    You can do somthing that say.
    Appache calls files in /www

    You can then tell it to short cut /www to /home or somthing and it will work the same a bit like a shortcut.

    I can't remember what it's called.


    I use it for torrentflux as /www is too small I have /www/tf and then that's linked to the files in /home/tf.

    *bangs head on wall* can't remember what is call sorry :(
     
  8. Andy Mc

    Andy Mc Modder

    Joined:
    23 May 2002
    Posts:
    1,743
    Likes Received:
    133
    That would be a symlink. You could also just edit the apache config to tell it to use /home/<user> as the root for the web content.

    However if you want to use the 2nd hd in the pc for photos then you will need to have it mounted so that you can access it. I'd suggest mounting it to something like /www/<site>/content This way with the right permissions it would just appear as a folder within your websites web root. much simpler. For stuff like this google will find all the answers you need. That and the Ubuntu forums are a goldmine for help as well.
     
    Votick likes this.
  9. Votick

    Votick My CPU's hot but my core runs cold.

    Joined:
    21 May 2009
    Posts:
    2,299
    Likes Received:
    102
    Rep left that's the one, Thanks :)
     
  10. TobletDanillio

    TobletDanillio Minimodder

    Joined:
    7 Jan 2012
    Posts:
    379
    Likes Received:
    5
    i think its /home/media atm but I'm not sure. As this is the first time using ubuntu its hard. I can do windows dos but there's no link lol
     

Share This Page