apachednswampmultiple-domainswindows-server-2016

Apache Server Unable to host multiple domain on single Public IP Error : "Not Found The requested URL / was not found on this server."


Apache Server Unable to host multiple domain on single Public IP running on Windows Server 2016

Error:"Not Found The requested URL / was not found on this server." 404 Not Found

Progress so far :

1)Edited Windows hosts file "C:\Windows\System32\drivers\etc\hosts": to below

127.0.0.1       localhost
::1             localhost
127.0.0.1       koffeeroasters.com

2)Changes made in the httpd.conf file of apache is below

changed

#Include conf/extra/httpd-vhosts.conf

to

Include conf/extra/httpd-vhosts.conf

also changed

#LoadModule rewrite_module modules/mod_rewrite.so

to

LoadModule rewrite_module modules/mod_rewrite.so

and added to the end of the file the following

# Tells Apache to identify which site by name
NameVirtualHost *:80
# Tells Apache to serve the default WAMP Server page to "localhost"
<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot "C:/wampstack/apache2/htdocs"
</VirtualHost> 
# Tells Apache to serve Client 1's pages to "client1.localhost"
# Duplicate and modify this block to add another client
<VirtualHost 127.0.0.1>
# The name to respond to
ServerName koffeeroasters.com
ServerAlias www.koffeeroasters.com
# Folder where the files live
DocumentRoot "C:/wampstack/apache2/htdocs/koffeeroasters.com/"
# A few helpful settings...
<Directory "C:/wampstack/apache2/htdocs/koffeeroasters.com/">

Order Allow,Deny
Allow from all
# Enables .htaccess files for this site
AllowOverride All
</Directory>
# Apache will look for these two files, in this order, if no file is specified in the URL
DirectoryIndex index.html index.php
</VirtualHost>

Other details

I am using apache server on bitnami wampstack.

Site is available when typed the address "koffeeroasters.com" from the servers browser.

A reason for it which I know no solution of (refered from apache docs "https://httpd.apache.org/docs/2.4/vhosts/examples.html") :

Note : Creating virtual host configurations on your Apache server does not magically cause DNS entries to be created for those host names. You must have the names in DNS, resolving to your IP address, or nobody else will be able to see your web site. You can put entries in your hosts file for local testing, but that will work only from the machine with those hosts entries.

Thanks a bunch. All help appreciated.


Solution

  • Try changing this:

    <VirtualHost 127.0.0.1>
    

    to

    <VirtualHost *:80>
    

    This means allow any other IPs connect on port 80, which should get you going. Trying to match the localhost is doing more than you probably need, unless you are public facing server, in which case you will not want to do this.