1

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?

2

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 address 127.0.0.1. The easiest way to do this is to add abc.com to the line in your /etc/hosts file that defines localhost.

127.0.0.1    localhost abc.com

You say

However, when I go to http://abc.com, it doesn't open the said index.htmlHTML file, which is located on /files/htdocs/mysites/abc.com/index.html. Instead, it opens the website of the TV network.

If you really are using abc.com then this would not be a good thing. You'd be much better off using abc.lan or abc.local or similar.

0
1

Add the abc.com domain to your /etc/hosts file:

127.0.0.1   localhost.localdomain    abc.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.