I'm trying to setup Apache virtual hosting in openSUSE, for a site called abc.com
(example purposes only). When I go to http://localhost/mysites/abc.com/index.html
on my browser, it opens correctly. However, when I go to http://abc.com
, it doesn't open the said index.html file, which is located on /files/htdocs/mysites/abc.com/index.html
. Instead, it opens the website of the TV network.
Here is my configuration:
default-server.conf
:
DocumentRoot "/files/htdocs"
<Directory "/files/htdocs">
Options None
AllowOverride All
Order allow,deny
Allow from all
</Directory>
NameVirtualHost 127.0.0.1
Note: I didn't change the other default values.
vhost.conf
inside vhosts.d/
, included thru httdp.conf
:
<VirtualHost 127.0.0.1>
DocumentRoot /files/htdocs/mysites/abc.com
servername abc.com
</VirtualHost>
Any ideas?
You need to make
abc.com
resolve to an IP address on which your webserver is listening. You appear to have everything on the loopback address127.0.0.1
. The easiest way to do this is to addabc.com
to the line in your/etc/hosts
file that defines localhost.You say
If you really are using
abc.com
then this would not be a good thing. You'd be much better off usingabc.lan
orabc.local
or similar.Add the
abc.com
domain to your/etc/hosts
file: