I recently reinstalled ubuntu on my system and I cannot get virtual hosts to work properly.
What I’m trying to accomplish is typing ‘test’ on my browser and pointing to my local machine on the location /var/www/test
I have followed several tutorials on the subject, and after every one of them, w3m test outputs the contents of the index.html on the test directory as expected, but when I go to firefox/chrome and type ‘test’ in the address bar, the browser googles it and shows me results.
So I’m wondering if there is something wrong with my process.
What I’ve been doing so far is:
- sudo apt-get install lamp-server^
- sudo gedit /etc/hosts
- append ‘127.0.0.1 test’ to hosts file
- save and exit
- sudo gedit /etc/apache2/sites-available/test
add the following lines to test:
<VirtualHost *:80> ServerName test DocumentRoot /var/www/test </virtualHost>
- save and exit
- sudo a2ensite test
- restart apache (tried sudo service apache2 restart, reload, and also
rebooted the whole system)
Any clues as to why w3m shows me the correct file and browsers refuse to do so?
Please note that I have cleared Firefox and Chrome caches several times.
——– Update ——-
It looks like I had misconfigured my lamp server in the first place.
The above process worked just fine when I reinstalled lamp (sadly I had to reinstall OS too), with one slight modification.
In step 3, you do not have to append the name of the vhost to the hosts file, you have to append it to the line that starts with 127.0.0.1 localhost (usually the first line)
I cannot accept any of the answers, since if someone faces the same difficulty in the future, none of the answers will give the solution.
I will have to search the configuration files to see exactly what was wrong, and the. I will post it.
Your browser is too smart, and thinks that if you enter a single word into the address bar, that you meant to search, rather than browse to a site. Enter in a complete URL instead, for instance:
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.