Hosts file aliases makes https calls buggy – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.
But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, apache-2.2, https, , .
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:
127.0.0.1 example.com # example.com 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?
Making your hostname resolve to 127.0.0.1 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.
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 127.0.0.1, 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…