Specifying Different IP's To Domains

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Specifying Different IP's To Domains

Postby 3Ddesktops.co.uk » 10. July 2009 13:23

Hello and hoping someone can help me, I have searched but no joy.

I have multiple domains set up on my 1and1 win2003 dedicated server and everything works fine.

I am trying to assign each domain to separate IP address. I have got my ip address associated with my domain through my 1and1 account so know that's acting as it should. I have also specified the new ip in my hosts file along with the domain name.

If anyone can tell me the complete steps on how to do this that would be great, I have searched but not found any definitive answers and everything I have tried has not worked.

I have added a listen command in conf file but apache won't restart.

Many thanks in advance
3Ddesktops.co.uk
 
Posts: 10
Joined: 10. July 2009 13:13

Re: Specifying Different IP's To Domains

Postby glitzi85 » 10. July 2009 13:36

In httpd.conf change Listen to
Code: Select all
Listen *:80

then in the httpd-vhosts.conf simply use the IP instead of the star:

Code: Select all
<VirtualHost IP1:80>
  ServerName example.com
</VirtualHost>

<VirtualHost IP2:80>
  ServerName example2.com
</VirtualHost>


You MUST NOT use NameVirtualHost for an IP that is used only for one VirtualHost. Example:

httpd-vhosts.conf:

Code: Select all
NameVirtualHost 192.168.0.2:80

<VirtualHost 192.168.0.1:80>
  #This IP is only used in one Host!
  ServerName example.com
</VirtualHost>

<VirtualHost 192.168.0.2:80>
  #This IP is used for two different subdomains:
  Servername foo.example.com
</VirtualHost>

<VirtualHost 192.168.0.2:80>
  Servername bar.example.com
</VirtualHost>


Same thing for SSL, except that you never need NameVirtualHost, as every SSL-Host must be bound to one Adress (this Adress however can be used for both, http AND https)

glitzi
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim

Re: Specifying Different IP's To Domains

Postby 3Ddesktops.co.uk » 10. July 2009 14:06

Brilliant, thank you - will try this - thanks again
3Ddesktops.co.uk
 
Posts: 10
Joined: 10. July 2009 13:13

Re: Specifying Different IP's To Domains

Postby 3Ddesktops.co.uk » 11. July 2009 16:33

Hi,

I have tried all your steps but am still running into an issue.

All other sites on the server are still up and running, but when I visit ***my-site-url*** is asks me to login?

A username and password are being requested by http://www.***my-site-url***. The site says: "xampp user"

Where would I find the permissions settings? Any help would be great.

Thanks again glitzi85
3Ddesktops.co.uk
 
Posts: 10
Joined: 10. July 2009 13:13

Re: Specifying Different IP's To Domains

Postby glitzi85 » 12. July 2009 19:30

Clear your Browser Cache and try again. If this did not help, please post your httpd-vhosts.conf

glitzi
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim

Re: Specifying Different IP's To Domains

Postby 3Ddesktops.co.uk » 12. July 2009 20:35

Thanks, I had tried that but no joy.

I think there may have been some delay because I no longer receive that error, jus a page load error.

Here's my httpd-vhosts.conf

Code: Select all
<VirtualHost *:80>
   ServerName localhost
   DocumentRoot "C:/xampp/htdocs"
</VirtualHost>

<VirtualHost *:80>
DocumentRoot C:/xampp/htdocs/
ServerName localhost
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName http://www.3***s.co.uk
DocumentRoot /xampp/htdocs/3***s.co.uk
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory htdocs/3***s.co.uk>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

************* Newly Added Domain ****************

<VirtualHost 87.106.226.49:80>
DocumentRoot D:/
ServerName localhost
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>

<VirtualHost 87.106.226.49:80>
ServerName http://www.f***s.com
DocumentRoot D:/f***s.com
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory D:/f***s.com>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


Thanks it is much appreciated
3Ddesktops.co.uk
 
Posts: 10
Joined: 10. July 2009 13:13

Re: Specifying Different IP's To Domains

Postby glitzi85 » 13. July 2009 08:55

Replace with this:

Code: Select all
NameVirtualHost *:80

<Directory "C:/xampp/htdocs">
  Options FollowSymLinks
  AllowOverride All
  Order allow,deny
  allow from all
</Directory>

<Directory "D:/f***s.com">
  Options FollowSymLinks
  AllowOverride All
  Order allow,deny
  allow from all
</Directory>

<VirtualHost *:80>
   ServerName www.3***s.co.uk
   ServerAlias 3***s.co.uk
   DocumentRoot "C:/xampp/htdocs/3***s.co.uk"
</VirtualHost>

<VirtualHost 87.106.226.49:80>
   ServerName www.f***s.com
   ServerAlias f***s.com
   DocumentRoot "D:/f***s.com"
</VirtualHost>

<VirtualHost *:80>
   ServerName localhost
   DocumentRoot "C:/xampp/htdocs"
</VirtualHost>


First of all: All the Directory-Blocks are not necessary. Every setting in the htdocs-Directory made is automatically inherited to subfolders. A construct like this:
Code: Select all
<VirtualHost *:80>
  DocumentRoot D:/xxx
  <Directory />
    [...]
  </Directory>
</VirtualHost>

is a very very bad idea. In your case, <Directory /> refers to C:\, not to the D-Partition as expected. In an Windows environment it is always better to provide the drive letter, if you work on more than one partition.
For security reasons i put the localhost vHost to the bottom. If you still have the XAMPP stuff there, it would be possible for everybody to access it, just by calling your IP.

glitzi
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim

Re: Specifying Different IP's To Domains

Postby 3Ddesktops.co.uk » 13. July 2009 13:28

Thanks glitzi85, but I'm still strugglin here. Cheers for your advice, I kinda set the server up muddlin through and as it worked hadn't realised that wasn't the best practice.

Now all I get is page load errors but my main domain ( http://www.3***s.co.uk ) remains live.

I change my httpd-vhosts.conf to the following:

Code: Select all
NameVirtualHost *:80


 <VirtualHost 87.***.49:80>
       ServerName www.f***s.com
       ServerAlias f***s.com
       DocumentRoot "D:/f***s.com"
    </VirtualHost>   


    <VirtualHost *:80>
       ServerName www.3***s.co.uk
       ServerAlias 3***s.co.uk
       DocumentRoot "C:/xampp/htdocs/3***s.co.uk"
    </VirtualHost>


      <VirtualHost *:80>
       ServerName localhost
       DocumentRoot "C:/xampp/htdocs"
    </VirtualHost>


Here's My Hosts File:

Code: Select all
127.0.0.1       localhost
87.***.98   3ddesktops.co.uk
87.***.49   www.fantasymobiles.com


I noticed I added my main site IP in my hosts file at some point, but this doen't seem to have effected anything anyway.

Sorry to be such a pain but I just can't seem to get this working right and must be missing something obvious but this is all new to me.

Thanks again for all your time and help
3Ddesktops.co.uk
 
Posts: 10
Joined: 10. July 2009 13:13

Re: Specifying Different IP's To Domains

Postby glitzi85 » 13. July 2009 17:47

Did you enter the IP into the Network interface settings? Do you have a firewall? There is no connection between your Server and the 1&1 Router. The configuration looks good, should work.

Better remove these entries from the hosts file. If you change something in your DNS-Server, you may
not think anymore about these settings and wonder, why it does not work.

glitzi
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim

Re: Specifying Different IP's To Domains

Postby 3Ddesktops.co.uk » 13. July 2009 18:41

Did you enter the IP into the Network interface settings?


Where is that? I followed some steps from another post in a forum and can't quite remember :0( Would this be in my one and one control panel or on the server? I believe my one and one settings are ok.

After a full server reboot my main domain residing in C:/xampp/htdocs/ is fine.

My other domains just state:

Access forbidden!


You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.


My new ip domain takes age to open then states:

Connection Interrupted
The connection to the server was reset while the page was loading.

The network link was interrupted while negotiating a connection. Please try again.

I've also removed the 2 entries in my host file and Windows firewall off.

I can understand if the new ip is having trouble working, but I must have done something wrong to kill all the other domains that are on the D:

Thanks again
3Ddesktops.co.uk
 
Posts: 10
Joined: 10. July 2009 13:13

Re: Specifying Different IP's To Domains

Postby glitzi85 » 13. July 2009 21:13

3Ddesktops.co.uk wrote:
Did you enter the IP into the Network interface settings?

Where is that?

Your Server must know his IP Adresses, otherwise he will not respond on connections for this IP. I think that is the problem you currently have. Do you have a root server or an virtual server?

Please click on Start -> Run -> cmd.exe and in the opening window execute this command:
Code: Select all
ipconfig /all

then post the output here.

glitzi
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim

Re: Specifying Different IP's To Domains

Postby 3Ddesktops.co.uk » 13. July 2009 21:34

Thanks, I have a dedicated server from 1and1 - I have full aceess

Here's the output:

Code: Select all
Windows IP Configuration

   Host Name . . . . . . . . . . . . : s15260269
   Primary Dns Suffix  . . . . . . . :
   Node Type . . . . . . . . . . . . : Unknown
   IP Routing Enabled. . . . . . . . : No
   WINS Proxy Enabled. . . . . . . . : No

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . :
   Description . . . . . . . . . . . : NVIDIA nForce N
   Physical Address. . . . . . . . . : 00-30-05-9E-C4-
   DHCP Enabled. . . . . . . . . . . : No
   IP Address. . . . . . . . . . . . : 87.106.70.98
   Subnet Mask . . . . . . . . . . . : 255.255.255.255
   Default Gateway . . . . . . . . . : 10.255.255.1
   DNS Servers . . . . . . . . . . . : 87.106.70.251
                                       195.20.224.99
3Ddesktops.co.uk
 
Posts: 10
Joined: 10. July 2009 13:13

Re: Specifying Different IP's To Domains

Postby glitzi85 » 13. July 2009 22:59

OK, you ordered an additional IP at 1&1? Did you get the Subnetmask for this IP from 1&1? If yes, then follow this instructions: http://theos.in/news/howto-windows-2000 ... p-address/
Just add there the .49-IP. Then check with ipconfig /all whether the IP is accepted or not. If not, restart Windows. When it is in the list, restart Apache. Then everything should work.

glitzi
User avatar
glitzi85
 
Posts: 1920
Joined: 05. March 2004 23:26
Location: Dahoim

Re: Specifying Different IP's To Domains

Postby 3Ddesktops.co.uk » 14. July 2009 01:06

Hi Glitzi and thanks again so much for your help with this.

I followed those steps on the link you gave but hit a brick wall when entering my settings, even though I know them to be correct.

But then.......Success............. well almost
After trawling the 1and1 help stuff I came across this page http://faq.oneandone.co.uk/server/ms_windows_servers/general_introduction/5.html

and after adding my details the new ip url works - yay!!! I checked through http://whois.domaintools.com and both urls show the correct ip.

However, although my main site on the other ip is still working, when I add my additional domains beneath using the same format IE:

Code: Select all
    <VirtualHost *:80>
       ServerName www.h***s.org
       ServerAlias h***s.org
       DocumentRoot "D:/h***s.org"
    </VirtualHost>

    <VirtualHost *:80>
       ServerName www.w***s.com
       ServerAlias w***s.com
       DocumentRoot "D:/w***s.com"
    </VirtualHost>


    <VirtualHost *:80>
       ServerName www.m***s.co.uk
       ServerAlias m***s.co.uk
       DocumentRoot "D:/m***rs.co.uk"
    </VirtualHost>


I get an access denied page for all the other domains, any ideas?

Just so close now, you've been a real star :lol:
3Ddesktops.co.uk
 
Posts: 10
Joined: 10. July 2009 13:13

Re: Specifying Different IP's To Domains

Postby Izzy » 14. July 2009 02:52

I get an access denied page for all the other domains, any ideas?
You must change the default very restrictive <Directory> directive for directories (folders) that reside outside the htdocs folder tree (the server's DocumentRoot) as defined in the httpd.conf file - but don't change the restrictive httpd.conf entry as this is a server security feature but rather change on a directory by directory basis for directories outside the htdocs directory.

For example using the first vhost in your list above:
Code: Select all
<VirtualHost *:80>
ServerName h***s.org
ServerAlias www.h***s.org
DocumentRoot "D:/h***s.org"
<Directory "D:/h***s.org">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
The other 2 in the above list also need to have the default restrictions removed by a similar <Directory> directive.

Virtual host directories contained within the DocumentRoot are blanket covered by its <Directory> directive in the httpd.conf file and so need no individual <Directory> directive unless you wish to change any of the individual directory's services and features.
http://httpd.apache.org/docs/2.2/mod/directives.html



As a matter of relevant interest this is the section in a default httpd.conf file that tells the server not to allow access to your above list of domains:
Code: Select all
DocumentRoot "C:/xampp/htdocs"

#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features. 
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 110 guests