I need to test a couple of websites locally, but only sometimes. The rest of the time I want to access them normally out on the web. I use a2ensite and a2dissite to enable and disable. But unless I also manually add a line in /etc/hosts, apache keeps serving the non-local version. That doesn't seem right. Here are the details:
I've made an entry in /etc/apache2/sites-available/molvray.com. I've made a link to it in /etc/apache2/sites-enabled. I've used sudo a2ensite molvray.com to enable it. I then reload apache2. When I go to the url in the browser, it gives me the web version, not the local version.
When I add the red line to /etc/hosts, then it gives me the local version:
Code:
127.0.0.1 localhost
127.0.1.1 snowy
127.0.2.2 www.molvray.com molvray.com
When I want to return to the normal, web version of molvray.com, I have to manually comment that line out. Running sudo a2dissite molvray.com and reloading apache is not enough.
That seems like a bad kludge. I must be doing something wrong, but I can't figure out what it is.
Bookmarks