Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Problem

My apache2 virtual host is not working. And I've totally no idea on what the error is.

What happended?

I've one virtual host named v1, and it works fine. Then I copied sites-available/v1 to sites-avaliable/v2 and changed the v2's content. After that a a2ensite and service apache2 restart is performed.

The error

Oops! Google Chrome could not find pie.example.com

and empty error log in /var/log/XXX.log

Files

[sites-avaliable/v1]

<VirtualHost *:80>
ServerName sym.example.com
ServerAdmin sym@mail.example.com
DocumentRoot "/var/www/symphony/symphony-2"
ErrorLog "/var/log/apache2/symphony_errors.log"
CustomLog "/var/log/apache2/symphony_accesses.log" common    
</VirtualHost>

[sites-avaliable/v2]

<VirtualHost *:80>
ServerName pie.example.com
ServerAdmin pie@mail.example.com
DocumentRoot "/var/www/sf2piemoment"
ErrorLog "/var/log/apache2/piemoment_errors.log"
CustomLog "/var/log/apache2/piemoment_accesses.log" common    
</VirtualHost>

hosts

127.0.0.1 example.com

Help

Any ideas and suggestions? I'm totally confused on this. Please help me on this. P.S. I'm pretty new to linux...

share|improve this question
    
Are you sure your DNS is set? Unless you have no default site, when vhosts dont work you generally get taken to the wrong site (default), and not given that sort of error. –  David Houde Jun 16 '13 at 12:38
    
@DavidHoude I added a hosts entry. Plz see the update. Terribly sorry for wasting your time. –  SolessChong Jun 16 '13 at 13:39
add comment

1 Answer

The error "could not find pie.example.com" means that the address pie.example.com can't be resolved in DNS. Since there is no DNS answer, your browser doesn't know that it should ask your apache for the site, and that is why there is nothing in your apache logs.

So step one is to fix your DNS settings so that the domain actually resolves. After that, if there are still problems, you can ask about those problems.

As you are using a hosts file instead of a DNS entry, you can simply add more names to the line in /etc/hosts:

127.0.0.7 localhost example.com sym.example.com pie.example.com

all on the same line.

share|improve this answer
    
I added a hosts entry. Please see the update. Sorry for leaving this out. and terribly sorry for wasting your time. –  SolessChong Jun 16 '13 at 13:37
    
Your hosts file does not contain sym.example.com, it only contains example.com. You need to actually write out the entire host name for each host; it doesn't do wildcards. –  Jenny D Jun 16 '13 at 16:36
    
Oh, and thanks a lot for apologizing, I really appreciate it! I wish more people would act the way you do here! –  Jenny D Jun 16 '13 at 16:37
    
I'm afraid there could be more problem since sym.example.com works but pie.example.com doesn't –  SolessChong Jun 16 '13 at 17:47
    
Still, the answer remains that this is not an apache error. Could you try adding pie.example.com to the hosts file, too? I'm adding a line to explain how to do that. –  Jenny D Jun 16 '13 at 18:34
show 1 more comment

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.