Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
15
rated 0 times [  15] [ 0]  / answers: 1 / hits: 20580  / 3 Years ago, fri, september 17, 2021, 11:55:47

I currently have all my websites as directories under /var/www. I would like to set up a virtual host http://foo/ that points to the /var/www/foo/foo directory (and still keep the default localhost behavior).



I added the following file, foo, to /etc/apache2/sites-available/:



<VirtualHost *:80>
ServerName foo
DocumentRoot /var/www/foo/foo

# Other directives here
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/foo/foo>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>


I then ran the following commands:



sudo a2ensite foo
sudo /etc/init.d/apache2 reload


But when I go to http://foo/ it still returns an ISP search page.


More From » apache2

 Answers
0

You need to edit your /etc/hosts file so that http://foo resolves to 127.0.0.1.



Edit the file /etc/hosts (with sudo/root) and add the following line:



127.0.0.1 foo

[#38895] Saturday, September 18, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
panshow

Total Points: 454
Total Questions: 98
Total Answers: 122

Location: Philippines
Member since Sat, Jul 11, 2020
4 Years ago
;