a2ensite problem?

i hit a snag pretty early one while following this guide:

https://library.linode.com/lamp-guides/ … e-pangolin">https://library.linode.com/lamp-guides/ubuntu-12.04-precise-pangolin

at this part:

> After you've set up your virtual hosts, issue the following commands:

a2ensite example.com

a2ensite example.org

when i do this i get ERROR: site squattheplanet.com does not exist! my input is like so:

a2ensite squattheplanet.com

i'm trying to learn how to do this in virtualbox before signing up with linode.

my virtual hosts looks like:

 <virtualhost *:80="">ServerAdmin webmaster@squattheplanet.com
     ServerName squattheplanet.com
     ServerAlias www.squattheplanet.com
     DocumentRoot /srv/www/squattheplanet.com/public_html/
     ErrorLog /srv/www/squattheplanet.com/logs/error.log
     CustomLog /srv/www/squattheplanet.com/logs/access.log combined</virtualhost> 

can anyone tell me what i'm doing wrong?

11 Replies

Is the virtual host configuration in a file named /etc/apache2/sites-available/squattheplanet.com? (Make sure you don't have any typos in the name.) That's what the a2ensite command is looking for.

If you think you have things correct, run the following command and post the output so we can see what might be going on.

ls -l /etc/apache2/sites-available

~~![](<URL url=)http://i1213.photobucket.com/albums/cc4 … 6fd54d.png">http://i1213.photobucket.com/albums/cc470/omensandportents/UbuntuServer_zps566fd54d.png" />

i think i got it spelled right, i coulda sworn i triple checked it.~~

What happens when you cat the file name? Does it display the contents?

Is it possible that there's a trailing blank on the file name?

Hmm, that is odd. James has one possibility; adding the -b option to ls should indicate any unusual characters with backslashes (ls -lb /etc/apache2/sites-available).

You could also try enabling it manually. The a2ensite command just creates a link from /etc/apache2/sites-enabled to /etc/apache2/sites-available. The following commands will create the link and reload Apache:

ln -sv /etc/apache2/sites-{available,enabled}/squattheplanet.com
apache2ctl restart

Not a Debian/Ubuntu/Apache2 user, but wasn't there something about the sites-enable files MUST end in .conf

Doing a quick google seems to point to something like that (but I really didn't double check to see if that was old info or what).

@Main Street James:

What happens when you cat the file name? Does it display the contents?

![](http://i1213.photobucket.com/albums/cc4 … 6aeed7.png">http://i1213.photobucket.com/albums/cc470/omensandportents/catfilename_zpsb46aeed7.png" />

@Vance:

Hmm, that is odd. James has one possibility; adding the -b option to ls should indicate any unusual characters with backslashes (ls -lb /etc/apache2/sites-available).

You could also try enabling it manually. The a2ensite command just creates a link from /etc/apache2/sites-enabled to /etc/apache2/sites-available. The following commands will create the link and reload Apache:

ln -sv /etc/apache2/sites-{available,enabled}/squattheplanet.com
apache2ctl restart

not sure how the unusual characters would be indicated? it looked pretty similar to a regular ls -al:

~~![](<URL url=)http://i1213.photobucket.com/albums/cc4 … 7f1869.png">http://i1213.photobucket.com/albums/cc470/omensandportents/lsbzpsd87f1869.png" />

although i do see a 'total 24' with ls -al and a 'total 16' with ls -lb.

using your command above to link the two here's what i got:

~~![](<URL url=)http://i1213.photobucket.com/albums/cc4 … 454895.png">http://i1213.photobucket.com/albums/cc470/omensandportents/fullyqualified_zps8e454895.png" />

not sure if that's okay?~~~~

I think vonskippy is right.

  • remove the symbolic link from sites-available/squattheplanet.com to sites-enabled/squattheplanet.com

  • change the name of sites-available/squattheplanet.com to sites-available/squattheplanet.com.conf

  • run a2ensite squattheplanet.com

This is what ls -lb would show for a file named "foo " with a space at the end of the name:

-rw-r--r-- 1 vance vance      0 Nov 11 16:10 foo\ 

That warning from Apache is nothing to worry about. Visiting www.squattheplanet.com seems to work so Apache is now using that configuration even though a2ensite doesn't like it.

As noted earlier, it's possible that your version of a2ensite requires ".conf" at the end of the name, although an older Ubuntu version does not. Just running a2ensite with no arguments should list the sites it thinks are available.

hmm, well im not sure what the issue was, but i actually ended up using nginx instead, and got myself set up in about 2 hours. so far everything is working great, and i'm pretty stoked about using linode. thanks for your help!

@vonskippy:

Not a Debian/Ubuntu/Apache2 user, but wasn't there something about the sites-enable files MUST end in .conf

Doing a quick google seems to point to something like that (but I really didn't double check to see if that was old info or what).

None of our virtual host files end with .conf. They all match their respective domains.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct