Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a strange behaviour on my VPS that I cannot explain.

My server is a Lucid Lynx. Apache version is 2.2.14

I wanted to make some requests to localhost faster, so I added an extra line in my /etc/hosts file: # is currently hosted on the same instance.

I restarted apache2, and after an hour of debugging I found that my server answers correctly to any https calls on 443 port when they are coming from a remote source, but tries to communicate with simple http, when I'm trying from it's own console.

Removing the alias from /etc/hosts and restarting apache2 fixes the problem.

Is there a common misconfiguration somewhere that can cause this behavior?

share|improve this question
Executing wget on the console causes a redirect to ? – Mark Wagner Aug 29 '12 at 16:21
Please update your question with the output of curl -I – Dave Forgac Aug 29 '12 at 16:51
How exactly is your HTTPS virtual host defined? What exactly do you have in the <VirtualHost ...> line in your config? – Zoredache Aug 29 '12 at 17:41
up vote 2 down vote accepted

Making your hostname resolve to used to be explicitly discouraged, for causing problem with "stupid programs". Connecting to a local IP should be fast regardless of using the loopback interface or not.

If removing the alias solves the problem, just do it.

share|improve this answer
That's right. I did not know that, but I just have tested it. Thank you. – mimrock Aug 30 '12 at 8:21

a) you dont need to restart apache after changing your /etc/hosts b) are you changing /etc/hosts and apache running off of same host? c) show us your apache's configuration

apache doesn't really listening on, so what you did seems wrong (to me at least)

[root@wcmisdlin02 ~]# netstat -tanpv | grep httpd
tcp        0      0 :::80                       :::*                        LISTEN      12428/httpd         
tcp        0      0 :::443                      :::*                        LISTEN      12428/httpd         
[root@wcmisdlin02 ~]# 

I think main thing is that your https virtual host is binded to a specific IP and you're trying to reach to it through different IP so that's where it brakes...

share|improve this answer

Your Answer


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.