Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I operate a VPS on Digital Ocean running Ubuntu 12.04.3, with virtual hosts. I was able to set things up following this tutorial here: https://www.digitalocean.com/community/articles/how-to-set-up-apache-virtual-hosts-on-ubuntu-12-04-lts

However, after a few days I navigated to my main domain (noelforte.com) to check and see if everything was running smoothly, but instead of seeing the landing page that I had temporarily set up, I instead was greeted with a directory listing.

Oddly enough, the subdomain I had configured with VHosts was still pointed to the right directory, however my main domain reverted to pointing at the default document root of /var/www.

Deleting the config files in /etc/apache2/sites-available and setting everything up again yielded the same results: any subdomain will point to the right location, however the root TLD remains stuck pointing to /var/www.

What might cause a situation like this, and why then did it initially work properly?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Solved it! Running sudo apache2ctl -S returned the following:

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server noelforte.com (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost noelforte.com (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost media.noelforte.com (/etc/apache2/sites-enabled/media.noelforte.com:1)

I decided to disable all sites including the default and just activate the sites that I needed. That resolved my problem.

If someone could explain why noelforte.com was running as default-000 as seen here:

port 80 namevhost noelforte.com (/etc/apache2/sites-enabled/000-default:1)

that would help shed some light on what may have been misconfigured. Thanks!

share|improve this answer
    
I had the same issue, for me it was because the ServerName was set the same as the domain in the 000-default file. –  Hard-Boiled Wonderland Feb 7 at 7:19

create a 000-default file in /etc/apache2/sites-avaliable, or if it is already existing edit it. It's where your webserver will point if there's no virtualhost defined for the site you're looking up.

Make sure to check that the file also exists in /etc/apache2/sites-enabled if it doesnt: ln -s /etc/apache2 sites-avaliable/000-default /etc/apache2/sites-enabled/

share|improve this answer
    
There is a default file already in my /etc/apache2/sites-available directory. I also have a virtual host for noelforte.com set up and enabled, however, it doesn't point to the document root defined in the vhost file. Why? –  Noel Forte Dec 23 '13 at 16:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.