Apache virtualhost configuration

Hello,

I got my Apache Webserver on my Windows machine running and I got my domain raindropworks.com registered with GoDaddy, I had put in my IP for GoDaddy to point to my address (the address of the webserver) but for some reason if you go to the website it times out, I am not sure if I configured my virtualhosts wrong in the configuration file? Can someone please take a look at it?

<snip/>

Apache blocks access to all folders by default, unless specifically told otherwise. So in your case you need to grant access to C:\websites\ using


<Directory "C:\\websites\\">
# AllowOverride all
  Order Allow,Deny
  Allow From All
</Directory>

If you want to make use of .htaccess file in that directory, uncomment “AllowOverride all”

That shouldn’t give timeout errors but a 403 permission denied btw. Can you access the website from your own PC? To test this you need to add the domain to your hosts file in the windows directory (if you haven’t already done so) so you can access it directly without using the internet.

s123,

It’s also likely that your ISP will be blocking you as hosting your own website via an ISP account is against your TOA.

Additionally, a subdomain is ANOTHER domain as far as Apache is concerned so you need a DNS daemon (or another vhosts.conf/hosts update).

Regards,

DK

Sorry David, but that’s just not true. He doesn’t need a DNS daemon on his PC for Apache to serve hisdomain.com. So long as hisdomain.com is in Apache’s config and the Name Servers of hisdomain.com are pointed to his PC it really doesn’t matter if the PC knows that it is running hisdomain.com on the DNS level.

All Apache cares about is a HTTP Request with a Host: hisdomain.com header to serve hisdomain.com.

so everything is resolved instead that the directory for that particular domain is wrong. how can i split different directories for each domain?

That quite a generic question. Could you please explain a bit what directories you have, how are they laid out, and to what domain(s) should they map?

Rémon,

The DNS daemon on a PC is merely the hosts file - a question of terminology - and it is required to direct the request appropriately.

s163,

Simply specify the correct drive:/directory in the httpd-vhosts.conf file for each domain. That’s worked since Apache 2.0.

Regards,

DK

Off Topic:

No it’s not. You only need the entry in the local DNS if you want to go to the address directly without using the internet. If the local DNS doesn’t know of the domain it will work just as well. The only things that matter are:

  1. The internet “knows” (DNS) that your IP serves example.com
  2. Apache on your PC knows that it serves example.com

Apache really couldn’t care less if example.com is in the local DNS. Why would you think it does?

well i have one folder for all my websites:

C:\websites

inside i will have a folder for each website for example raindropworks.com

C:\websites\raindropworks

how can i set that up properly?

Exactly you have now, but you do need to add “:80” to the NameVirtualHost and then just add more virtual hosts:


NameVirtualHost 69.246.210.143:80
 
<VirtualHost 69.246.210.143:80>
  DocumentRoot C:\\websites\\raindropworks
  ServerName www.raindropworks.com
</VirtualHost>

<VirtualHost 69.246.210.143:80>
  DocumentRoot C:\\websites\\otherwebsite
  ServerName www.otherwebsite.com
</VirtualHost>


Off Topic:

To prove this I just added ServerAlias notinmylocaldns.com to one of the virtual hosts on my dedicated server and put


[I]ip.of.my.server[/I]  notinmylocaldns.com

in my hosts file.

I did not put anything regarding notinmylocaldns.com in the DNS of my dedicated server so at this point my server has no clue whatsoever that DNS might refer to it as notinmylocaldns.com. Yet when I request the URL it works just fine.
My PC knows where to find it (via the hosts file) and the server knows what to serve (via the ServerAlias).

it is like that but i still get the default “it works!” apache message.

I get Forbidden Error right now :frowning:

For some reason evne though my virtualhost is set to C:\websites\raindropworks\

it is still seeking the C:\websites

new configuration:

<snip/>

Is your PC aware that it’s IP is 69.246.210.143 ? Or is the PC on a LAN behind a router/modem and is 69.246.210.143 just the external IP of the router/modem?

If the latter is the case you should replace 69.246.210.143 in the configuration with the LAN IP of your PC.

i did that but still i got the same issue. the forbidden error goes away when i put an index.html file into the C:\websites but i need for the raindropworks.com for it took in C:\websites\raindropworks\

i think there is an issue in the config file but not sure what.

You should restart Apache after you make a change like replacing one IP for another. Did you do that?

yes of course

Okay. Try this:


NameVirtualHost *:80
 
<VirtualHost *:80>
  DocumentRoot C:\\websites\\raindropworks
  ServerName www.raindropworks.com
  ServerAlias raindropworks.com
</VirtualHost>

Does that work?

nope still says Forbidden :frowning:

i got it working, i got wordpress installed problem is that locally i can see the images, from another computer i cannot see the images.