# apache virtual host help



## boogerlad (Mar 18, 2011)

Hi everyone, I've got apache set up, a static ip in lan and wan, and two domains bought. (one from name.com and one from godaddy.com) 
Right now, in the httpd-vhosts.conf, I've got 

```
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
    ServerAdmin admin@dimetraveller.com
    DocumentRoot "C:\Documents and Settings\Administrator\My Documents\Dropbox\dimetraveller"
    ServerName dimetraveller.com
    ServerAlias www.dimetraveller.com
    ErrorLog "logs/dummy-host.dimetraveller.com-error.log"
    CustomLog "logs/dummy-host.dimetraveller.com-access.log" common
<Directory "C:\Documents and Settings\Administrator\My Documents\Dropbox\dimetraveller">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
#
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin admin@frappaday.com
    DocumentRoot "C:\Documents and Settings\Administrator\My Documents\Dropbox\frap"
    ServerName frappaday.com
    ServerAlias www.frappaday.com
    ErrorLog "logs/dummy-host2.dimetraveller.com-error.log"
    CustomLog "logs/dummy-host2.dimetraveller.com-access.log" common
<Directory "C:\Documents and Settings\Administrator\My Documents\Dropbox\frap">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
#
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>
</VirtualHost>
```

and in my httpd.conf, I've enabled to virtualhost section by uncommenting it. For the domains, I've set up url forwarding to my static ip. However, only the first site works. The second site is a exact duplicate of the first :S

Thanks


----------



## W1zzard (Mar 18, 2011)

what's in your browser address bar when the page is loaded?

you need it to be the same host as in your virtual host section. if godaddy uses http redirects this won't work


----------



## boogerlad (Mar 18, 2011)

dimetraveller.com or frappaday.com
I'm using masked url forwarding for both of them.


----------



## Easy Rhino (Mar 18, 2011)

the best way is to have both your domain names A records set to your server. then apache handles the requests itself. much easier if you ask me. and you dont need to setup vhosts, you can simply add another site in sites-available. just make sure ot include the domain name and the working directory. that way apache knows that if a request for domain 1 comes in it can load the right directory.


----------



## boogerlad (Mar 18, 2011)

I'm a noob at this, but how would I set both domain names to my server? Isn't it already like that if I forward the ip with masking?


----------



## Zyon (Mar 20, 2011)

<VirtualHost *Domain Name*:80>

I think 

So...

<VirtualHost *dimetraveller.com*:80>
(dimetraveller.com settings...)
2. <VirtualHost *frappaday.com*:80>
(frappaday.com settings...)


----------

