Results 1 to 3 of 3

Thread: Setting Up A Virtual Host

  1. #1
    Join Date
    Jul 2007
    Beans
    14

    Angry Setting Up A Virtual Host

    Hey everyone, I've been reading and searching how to do this and I understand the basics, but I'm missing some fundamentals on how to set this up. I've never really worked inside the command line like this before, so please go easy on me.

    I downloaded and setup Ubuntu Server on a box I had laying around. I installed Apache, PHP5, and MySQL and what I would like to do is point a few domains to this box so outsiders can view the content. After reading a bunch of post, I have a pretty good idea on how to do this, but I'm a little stuck.

    I'm told that each domain should have a vhost file created within the "/etc/apache2/sites-available/" folder. Problem is, I don't know how to create that file, or which command to use to create it and when ever I try to edit the default file, I get this:

    Code:
    ken@ubuntu:/etc/apache2/sites-available$ edit Default
    Warning: unknown mime-type for "Default" -- using "application/*"
    Error: no write permission for file "Default"
    I feel dumb for even asking, but can someone show me how I create the file? Once I figure that out, this should probably be the contents of the file right? Just want to make sure I'm doing this right.

    Code:
     <VirtualHost *:80>
             ServerName example.com
             ServerAlias www.example.com *.example.com
             DocumentRoot /var/example/www
     </VirtualHost>
    Then I should run this and restart apache.

    Code:
    cd /etc/apache2/sites-enabled/
    ln -s ../sites-available/example.com
    Am I on the right track and how do I physical create the file.

    Thanks for reading!

    Ken

  2. #2
    Join Date
    May 2007
    Location
    Phoenix, Arizona USA
    Beans
    2,909
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Setting Up A Virtual Host

    To edit the file use nano:

    Code:
    sudo nano etc/apache2/sites-available

    When you are done, type ctl O (the letter O) and hit enter to save, then ctl X to exit, it's all there on a menu at the bottom.

    Don't forget to restart Apache when you're done.

    -Tim
    www.pcchopshop.net

    Hard to find and obsolete PC and server parts. "If we can't find it, it probably doesn't exist"

  3. #3
    Join Date
    Jul 2007
    Beans
    14

    Re: Setting Up A Virtual Host

    Thanks Tim, but everytime I try that I get this error:

    [ Error writing etc/apache2/sites-available/default: No such file or directory ]

    Edit: I think I got it.
    Last edited by Ken Iovino; August 22nd, 2008 at 06:51 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •