Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: VirtualHosting problem: "ERROR: Site mysite.com does not exist!"

  1. #1
    Join Date
    Nov 2012
    Location
    Great Britain
    Beans
    80

    VirtualHosting problem: "ERROR: Site mysite.com does not exist!"

    I'm trying to set up Apache2 to use VirtualHosting.
    But even after following tutorials online, I get an error...

    I've found the "apache2.conf" file, the "conf.d" folder and the "sites-enabled folder"; I've added the line:

    NameVirtualHost *
    into a file called "virtual.conf" in the "conf.d" folder, I've added the file "mysite.com.conf" into the sites enabled folder, containing the following code:

    GNU nano 2.2.6 File: mysite.com.conf

    #
    # mysite.com (/etc/apache2/sites-available/mysite.com)
    #
    <VirtualHost *>
    ServerAdmin webmaster@mysite.com
    ServerAlias www.mysite.com

    # Indexes + Directory Root.
    DirectoryIndex index.html
    DocumentRoot /var/www/mysite.com/

    # CGI Directory
    ScriptAlias /cgi-bin/ /home/www/mysite.com/cgi-bin/
    <Location /cgi-bin>
    Options +ExecCGI
    </Location>


    # Logfiles
    ErrorLog /var/www/mysite.com/logs/error.log
    CustomLog /var/www/mysite.com/logs/access.log combined
    </VirtualHost>
    however, when i run a2ensite I get the error that the website doesn't exist...
    I've added the entry to it in bind9, and I still can't get by this error...

    ERROR: Site mysite.com does not exist!
    the tutorial I found is here http://www.debian-administration.org/articles/412

    any help solving this problem would be greatly appreciated!

  2. #2
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: VirtualHosting problem: "ERROR: Site mysite.com does not exist!"

    You need to create a file in /etc/apache2/sites-available and then enable it with a2ensite somesite.

    Copy the default file, and change the contents as you wish and enable it.
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  3. #3
    Join Date
    Nov 2012
    Location
    Great Britain
    Beans
    80

    Re: VirtualHosting problem: "ERROR: Site mysite.com does not exist!"

    that's exactly what I've done, I don't understand why it doesn't work

  4. #4
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: VirtualHosting problem: "ERROR: Site mysite.com does not exist!"

    Does /var/www/mysite.com exist?

    If it does, check the name of the file you are trying to enable. That is the likely problem.

    FWIW, I use the site names as my virtualhost names, so I know which is which. I have a file for my site in /etc/apache2/sites-available named charlesa.net, so I need to enable it by typing:

    Code:
    sudo a2ensite charlesa.net
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  5. #5
    Join Date
    Nov 2008
    Location
    S.H.I.E.L.D. 6-1-6
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: VirtualHosting problem: "ERROR: Site mysite.com does not exist!"

    Quote Originally Posted by Toriku View Post
    I'm trying to set up Apache2 to use VirtualHosting.
    But even after following tutorials online, I get an error...

    I've found the "apache2.conf" file, the "conf.d" folder and the "sites-enabled folder"; I've added the line:



    into a file called "virtual.conf" in the "conf.d" folder, I've added the file "mysite.com.conf" into the sites enabled folder, containing the following code:



    however, when i run a2ensite I get the error that the website doesn't exist...
    I've added the entry to it in bind9, and I still can't get by this error...



    the tutorial I found is here http://www.debian-administration.org/articles/412

    any help solving this problem would be greatly appreciated!
    a few problems here:
    1.
    Code:
    NameVirtualHost
    is supposed to be already in ports.conf, and should include the port.

    i.e.
    Code:
    NameVirtualHost *:80
    2. You don't place your site in sites-enabled if you want to use a2ensite. You place it in sites-available

    3. Your virtual host should have
    Code:
    <VirtualHost *:80>
    instead of
    Code:
    <VirtualHost *>
    In addition, unless that is the only site you are serving (that would defeat the purpose of Virtual Hosts right?)
    you would need a
    Code:
     ServerName
    in the Virtual host as well
    i.e.
    Code:
     ServerName content.sandyd.me
    Note that instead of the * in
    Code:
    <VirtualHost>
    You can enter
    Code:
    <VirtualHost <ip address>:80>
    note that the above example listen on all ips, I removed the examples that listen on specific ips.
    Last edited by sandyd; December 22nd, 2012 at 06:35 PM. Reason: simplified
    Don't waste your energy trying to change opinions ... Do your thing, and don't care if they like it.

  6. #6
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    11,642
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: VirtualHosting problem: "ERROR: Site mysite.com does not exist!"

    The file /etc/apache2/ports.conf already enables NameVirtualHost with a target of "*:80". The <VirtualHost> declaration must match that target identically, i.e., "<VirtualHost *:80>".

    Toriku, did you read the relevant parts of the Ubuntu Server Guide?
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  7. #7
    Join Date
    Nov 2012
    Location
    Great Britain
    Beans
    80

    Re: VirtualHosting problem: "ERROR: Site mysite.com does not exist!"

    its enabled now, I'm not sure what I did any different... Getting some other problems now, I can't access the site with its IP address and the DNS isn't working properly anymore, I can access sites hosted by other servers on the network, but not either of the two hosted on the virtual apache server (this machine also hosts the DNS).

    thanks for your help guys,

  8. #8
    Join Date
    Nov 2012
    Location
    Great Britain
    Beans
    80

    Re: VirtualHosting problem: "ERROR: Site mysite.com does not exist!"

    Quote Originally Posted by SeijiSensei View Post
    The file /etc/apache2/ports.conf already enables NameVirtualHost with a target of "*:80". The <VirtualHost> declaration must match that target identically, i.e., "<VirtualHost *:80>".

    Toriku, did you read the relevant parts of the Ubuntu Server Guide?

    no I don't think I've read this one, I'll have a read through it today

  9. #9
    Join Date
    May 2007
    Location
    NY's first capital
    Beans
    2,652
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: VirtualHosting problem: "ERROR: Site mysite.com does not exist!"

    Quote Originally Posted by Toriku View Post
    its enabled now, I'm not sure what I did any different... Getting some other problems now, I can't access the site with its IP address and the DNS isn't working properly anymore, I can access sites hosted by other servers on the network, but not either of the two hosted on the virtual apache server (this machine also hosts the DNS).

    thanks for your help guys,
    You don't have the ServerName directive listed in your vhost file. This is described in the how to you listed.

    For the "other problems" more description of symptoms will yield accurate help.

    Can you ping the server by it's ip, hostname, and vhost domain name (after fixing vhost file "ServerName")?

    Did you restart apache after making your changes?

    To check you DNS run the following commands on both the server and a second lan machine.

    Code:
    host mysite.com
    Code:
    dig mysite.com
    Are your lan machines set to use this server as DNS server? Do you see it listed as NameServer?
    Code:
    cat /etc/resolv.conf
    Nothing is ever easy, but if it is difficult you must be doing it wrong.

  10. #10
    Join Date
    Nov 2012
    Location
    Great Britain
    Beans
    80

    Re: VirtualHosting problem: "ERROR: Site mysite.com does not exist!"

    Quote Originally Posted by volkswagner View Post
    You don't have the ServerName directive listed in your vhost file. This is described in the how to you listed.

    For the "other problems" more description of symptoms will yield accurate help.

    Can you ping the server by it's ip, hostname, and vhost domain name (after fixing vhost file "ServerName")?

    Did you restart apache after making your changes?

    To check you DNS run the following commands on both the server and a second lan machine.

    Code:
    host mysite.com
    Code:
    dig mysite.com
    Are your lan machines set to use this server as DNS server? Do you see it listed as NameServer?
    Code:
    cat /etc/resolv.conf


    From my windows PC I could ssh to the server, ping it, ftp... I just couldn't get a webpage up in my browser either with the domain or with IP address;
    there are two servers on the local network and one remote one, each one running apache, and the 3rd server was hosting DNS and virtualhosting 2 apache sites I couldn't access, I've moved DNS over to the 2nd server and now everything seems to be working, I think there was something gone astray in the DNS, odd as it was working fine before christmas

Page 1 of 2 12 LastLast

Tags for this Thread

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
  •