Hosts file doesn’t work with .com host names – 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 apache-2.2, virtualhost, hosts, firefox, google-chrome.
My /etc/hosts file is configured as following:
127.0.0.1 localhost mysitea.local mysiteb.com www.mysiteb.com www.mysitea.local
And I have my Apache virtual hosts setup accordingly:
<VirtualHost *:80> ServerName www.mysitea.local ServerAlias mysitea.local WSGIScriptAlias / /var/www/mysitea/apache/django.wsgi <Directory /var/www/mysitea> Order deny,allow Allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerName www.mysiteb.com ServerAlias mysiteb.com WSGIScriptAlias / /var/www/mysitea/apache/django.wsgi <Directory /var/www/mysitea> Order deny,allow Allow from all </Directory> </VirtualHost>
When I type mysitea.local in the browser, the hostname is resolved as expected. However, the hostname is not resolved when I type mysiteb.com in the browser. It does work when I ping to the hostname. I get the same issue every time I try to add a “.com” hostname.
I highly doubt that this is a cache refresh issue. I have reset my cache several times and tried again and it still doesn’t work!
I’ll take a guess: your browser is actually requesting
www.mysiteb.com (or its cached the result for
www.mysiteb.com has non-resolving). Add that to your hosts file too, and it should work just fine.
127.0.0.1 localhost mysitea.local mysiteb.com www.mysiteb.com
If it still doesn’t work, clear your browsers cache and/or restart your browser.