Skip to contentSkip to conversation

Problem running two domains on one Apache server

DISCUSSION Nilesh Sahita 7 participants 11 messages Jun 18, 2003

lore
Share & tools
lore
#0 lore raw

Hi,

I am trying to run two domains on one Apache domain.

The system config is: RH9, Apache 2.0.40

I setup two domains - nstest1.homedns.org and nstest2.homedns.org

In Apache configuration, I create two virtual servers - the entries from httpd.conf are:

Quote

...

NameVirtualHost *

<VirtualHost nstest1.homedns.org>
DocumentRoot "/var/www/html/test1"
ServerName nstest1.homedns.org
DirectoryIndex index.html index.php index.htm
</VirtualHost>

<VirtualHost nstest2.homedns.org>
DocumentRoot "/var/www/html/test2"
ServerName nstest2.homedns.org
DirectoryIndex index.html index.php index.htm
LogLevel debug
</VirtualHost>

End-quote

In /var/www/html/test1 and /var/www/html/test2, I have two simple index.html files.

When I access http://nstest1.homedns.org, I serves up test1/index.html - which is what I expected. However, when I access
http://nstest2.homedns.org, it serves up test1/index.html instead of test2/index.html.

I tried clearing browser cache, restarting apache but doesn't help.

Anyone got idea what could be potentially going wrong?

TIA for any pointers/help.

Regards.

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#1 lore raw
Quoted 4 lines · Nilesh Sahita

When I access http://nstest1.homedns.org, I serves up test1/index.html - which is what I expected. However, when I access
http://nstest2.homedns.org, it serves up test1/index.html instead of test2/index.html.

Are you accessing the sites inside a local network? Some routers and firewalls have issues with internal loopback and virtual domains.

If you are behind a router/firewall then try to connect from outside the network and see what happens.

Hope that helps.

James

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#2 lore raw
In reply to Nilesh Sahita

Change it so it looks like this

<VirtualHost *>
DocumentRoot "/var/www/html/test1"
ServerName nstest1.homedns.org
DirectoryIndex index.html index.php index.htm
</VirtualHost>

<VirtualHost *>
DocumentRoot "/var/www/html/test2"
ServerName nstest2.homedns.org
DirectoryIndex index.html index.php index.htm
LogLevel debug
</VirtualHost>

the directive in the vitrual host line is what tells apache what interface/ip to listen on. assuming you only have one IP address on that box, you could also just put that address there instead of the *

Quoted 23 lines · Nilesh Sahita

Hi,

I am trying to run two domains on one Apache domain.

The system config is: RH9, Apache 2.0.40

I setup two domains - nstest1.homedns.org and nstest2.homedns.org

In Apache configuration, I create two virtual servers - the entries from httpd.conf are:

Quote

...

NameVirtualHost *

<VirtualHost nstest1.homedns.org>
DocumentRoot "/var/www/html/test1"
ServerName nstest1.homedns.org
DirectoryIndex index.html index.php index.htm
</VirtualHost>

Quoted 11 lines

<VirtualHost nstest2.homedns.org>
DocumentRoot "/var/www/html/test2"
ServerName nstest2.homedns.org
DirectoryIndex index.html index.php index.htm
LogLevel debug
</VirtualHost>

End-quote

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#3 lore raw

Hi Jim,

My IP address is dynamic - so I guess it is not possible to put IP address instead of * as you suggested. Am I right?

I tried changing <VirtualHost nstest1.homedns.org> to <VirtualHost *>.

When I do that, upon trying to access http://nstest1.homedns.org, I get error:

Quote

Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port. Instead use the HTTPS scheme to access this URL, please.

Hint: https://nstest1.homedns.org/

________________________________________________________________________
Apache/2.0.40 Server at nstest1.homedns.org Port 80

End-quote

If I try to access via https://nstest1.homedns.org, it works.

Any idea why this is happening?

TIA.

Regards,
- Nilesh

Quoted 59 lines · Jim Limmer

Change it so it looks like this

<VirtualHost *>
DocumentRoot "/var/www/html/test1"
ServerName nstest1.homedns.org
DirectoryIndex index.html index.php index.htm
</VirtualHost>

<VirtualHost *>
DocumentRoot "/var/www/html/test2"
ServerName nstest2.homedns.org
DirectoryIndex index.html index.php index.htm
LogLevel debug
</VirtualHost>

the directive in the vitrual host line is what tells apache what interface/ip to listen on. assuming you only have one IP address on that box, you could also just put that address there instead of the *

Quoted 23 lines · Nilesh Sahita

Hi,

I am trying to run two domains on one Apache domain.

The system config is: RH9, Apache 2.0.40

I setup two domains - nstest1.homedns.org and nstest2.homedns.org

In Apache configuration, I create two virtual servers - the entries from httpd.conf are:

Quote

...

NameVirtualHost *

<VirtualHost nstest1.homedns.org>
DocumentRoot "/var/www/html/test1"
ServerName nstest1.homedns.org
DirectoryIndex index.html index.php index.htm
</VirtualHost>

Quoted 11 lines

<VirtualHost nstest2.homedns.org>
DocumentRoot "/var/www/html/test2"
ServerName nstest2.homedns.org
DirectoryIndex index.html index.php index.htm
LogLevel debug
</VirtualHost>

End-quote

Quoted 5 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#4 lore raw

OK.

I had this same problem when using the default install of apache on RH 8.0 it seems its enabling SSL sites by default. If you are not planning on using this,

go into /etc/httpd/conf.d

and get rid of ssl.conf - copy it someplace else in case you want to use it again at a later time.

restart the httpd service and you should find it working.

Quoted 105 lines · Nilesh Sahita

Hi Jim,

My IP address is dynamic - so I guess it is not possible to put IP address instead of * as you suggested. Am I right?

I tried changing <VirtualHost nstest1.homedns.org> to <VirtualHost *>.

When I do that, upon trying to access http://nstest1.homedns.org, I get error:

Quote

Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port. Instead use the HTTPS scheme to access this URL, please.

Hint: https://nstest1.homedns.org/

________________________________________________________________________
Apache/2.0.40 Server at nstest1.homedns.org Port 80

End-quote

If I try to access via https://nstest1.homedns.org, it works.

Any idea why this is happening?

TIA.

Regards,
- Nilesh

Quoted 59 lines · Jim Limmer

Change it so it looks like this

<VirtualHost *>
DocumentRoot "/var/www/html/test1"
ServerName nstest1.homedns.org
DirectoryIndex index.html index.php index.htm
</VirtualHost>

<VirtualHost *>
DocumentRoot "/var/www/html/test2"
ServerName nstest2.homedns.org
DirectoryIndex index.html index.php index.htm
LogLevel debug
</VirtualHost>

the directive in the vitrual host line is what tells apache what interface/ip to listen on. assuming you only have one IP address on that box, you could also just put that address there instead of the *

Quoted 23 lines · Nilesh Sahita

Hi,

I am trying to run two domains on one Apache domain.

The system config is: RH9, Apache 2.0.40

I setup two domains - nstest1.homedns.org and nstest2.homedns.org

In Apache configuration, I create two virtual servers - the entries from httpd.conf are:

Quote

...

NameVirtualHost *

<VirtualHost nstest1.homedns.org>
DocumentRoot "/var/www/html/test1"
ServerName nstest1.homedns.org
DirectoryIndex index.html index.php index.htm
</VirtualHost>

Quoted 13 lines

<VirtualHost nstest2.homedns.org>
DocumentRoot "/var/www/html/test2"
ServerName nstest2.homedns.org
DirectoryIndex index.html index.php index.htm
LogLevel debug
</VirtualHost>

End-quote

Quoted 7 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Quoted 8 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#5 lore raw

Thanks!

This seem to have resolved the issue.

Now I am able to access both homepages from both - inside as well as outside the network.

Many thanks!

Regards,
- Nilesh

Quoted 131 lines · Jim Limmer

OK.

I had this same problem when using the default install of apache on RH 8.0 it seems its enabling SSL sites by default. If you are not planning on using this,

go into /etc/httpd/conf.d

and get rid of ssl.conf - copy it someplace else in case you want to use it again at a later time.

restart the httpd service and you should find it working.

Quoted 105 lines · Nilesh Sahita

Hi Jim,

My IP address is dynamic - so I guess it is not possible to put IP address instead of * as you suggested. Am I right?

I tried changing <VirtualHost nstest1.homedns.org> to <VirtualHost *>.

When I do that, upon trying to access http://nstest1.homedns.org, I get error:

Quote

Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port. Instead use the HTTPS scheme to access this URL, please.

Hint: https://nstest1.homedns.org/

________________________________________________________________________
Apache/2.0.40 Server at nstest1.homedns.org Port 80

End-quote

If I try to access via https://nstest1.homedns.org, it works.

Any idea why this is happening?

TIA.

Regards,
- Nilesh

Quoted 59 lines · Jim Limmer

Change it so it looks like this

<VirtualHost *>
DocumentRoot "/var/www/html/test1"
ServerName nstest1.homedns.org
DirectoryIndex index.html index.php index.htm
</VirtualHost>

<VirtualHost *>
DocumentRoot "/var/www/html/test2"
ServerName nstest2.homedns.org
DirectoryIndex index.html index.php index.htm
LogLevel debug
</VirtualHost>

the directive in the vitrual host line is what tells apache what interface/ip to listen on. assuming you only have one IP address on that box, you could also just put that address there instead of the *

Quoted 23 lines · Nilesh Sahita

Hi,

I am trying to run two domains on one Apache domain.

The system config is: RH9, Apache 2.0.40

I setup two domains - nstest1.homedns.org and nstest2.homedns.org

In Apache configuration, I create two virtual servers - the entries from httpd.conf are:

Quote

...

NameVirtualHost *

<VirtualHost nstest1.homedns.org>
DocumentRoot "/var/www/html/test1"
ServerName nstest1.homedns.org
DirectoryIndex index.html index.php index.htm
</VirtualHost>

Quoted 13 lines

<VirtualHost nstest2.homedns.org>
DocumentRoot "/var/www/html/test2"
ServerName nstest2.homedns.org
DirectoryIndex index.html index.php index.htm
LogLevel debug
</VirtualHost>

End-quote

Quoted 7 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Quoted 8 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Quoted 5 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#6 lore raw
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

<VirtualHost *>
DocumentRoot "/var/www/html/test1"
ServerName nstest1.homedns.org
DirectoryIndex index.html index.php index.htm
</VirtualHost>

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

<VirtualHost *>
DocumentRoot "/var/www/html/test2"
ServerName nstest2.homedns.org
DirectoryIndex index.html index.php index.htm
LogLevel debug
</VirtualHost>

NameVirtualHost *

Doesn't NameVirtualHost need a IP number?

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#7 lore raw

I am able to do with 'NameVirtualHost *'. I can't specify IP number because I don't have fix IP and am using Dynamic DNS Service provided by http://www.dyndns.org.

For details check - http://www.dyndns.org/support/kb/apachevhosts.html

Quoted 16 lines · Master_PE
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

<VirtualHost *>
DocumentRoot "/var/www/html/test1"
ServerName nstest1.homedns.org
DirectoryIndex index.html index.php index.htm
</VirtualHost>

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

<VirtualHost *>
DocumentRoot "/var/www/html/test2"
ServerName nstest2.homedns.org
DirectoryIndex index.html index.php index.htm
LogLevel debug
</VirtualHost>

NameVirtualHost *

Quoted 7 lines

Doesn't NameVirtualHost need a IP number?

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#9 lore raw

Re: Silly Question

Quoted 4 lines · John T. Williams

anyone know how or where I could get the source code for basic linux programs like "ls" and or "mkdir" or "rm" ?

Quoted 8 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

.

The basic fileutils (ls, cp, rm, etc) can be found at:
http://www.gnu.org/software/fileutils/fileutils.html

You might also want to take a look at:
http://www.gnu.org/software/coreutils/

GNU's webpage holds many if not all of the Linux utils.
http://www.gnu.org/

Signature · 10 lines
Flemming Greve Skovengaard               Be it the Devil or be it him
a.k.a Greven                             You can count on just one thing
<[email protected]>              When the time is up, you'll know
4168.08 BogoMIPS                         Not just one power runs the show

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
#10 lore raw

Re: Silly Question

Quoted 3 lines · Flemming Greve Skovengaard
Quoted 2 lines · John T. Williams

anyone know how or where I could get the source code for basic linux programs like "ls" and or "mkdir" or "rm" ?

[...]

Quoted 8 lines

The basic fileutils (ls, cp, rm, etc) can be found at:
http://www.gnu.org/software/fileutils/fileutils.html

You might also want to take a look at:
http://www.gnu.org/software/coreutils/

GNU's webpage holds many if not all of the Linux utils.
http://www.gnu.org/

Good options all. An additional one is the source packages associated with whichever Linux distribution you use.

In Debian, as an example, you can use the command "dpkg-query -S filename" to find the package that holds any file actually on your system. You can then use "apt-get source packagename" to install it.

I imagine the other packaging systems (or at least RPM) have analogous capabilities. Slackware CDs used to include a complete filelist that you could grep to match an app to its .tgz package.

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs