Jump to content

[SOLVED] BIND and Apache Virtual Host


etrader

Recommended Posts

I have two domain on my server. I configured BIND DNS and two virtual host on apache server for them.

 

The first domain works well, but when browsing the second domain, it shows the content of first apache virtual host, instead of the second one with the name of the second domain.  :(

Link to comment
https://forums.phpfreaks.com/topic/151545-solved-bind-and-apache-virtual-host/
Share on other sites

It's a long file on /etc/httpd/conf

 

I think you mean the last part, which is

 

<VirtualHost 200.35.149.48>

DocumentRoot "/var/www/html/site1"

<Directory "/var/www/html/site1">

allow from all

Options +Indexes

</Directory>

</VirtualHost>

<VirtualHost 200.35.149.48>

DocumentRoot "/var/www/html/site2"

<Directory "/var/www/html/site2">

allow from all

Options +Indexes

</Directory>

</VirtualHost>

You need to be using name based virtual hosts.

 

 

 

Basic example:

 

 

NameVirtualHost *:80

<VirtualHost *:80>

ServerName domain1.tld

DocumentRoot "/path/to/doc/root/"

</VirtualHost>

 

<VirtualHost *:80>

ServerName domain2.tld

DocumentRoot "/path/to/doc/root2/"

</VirtualHost>

Sorry for this, but the problem still persists :(

 

The httpd.conf now looks like

 

<VirtualHost *:80>

DocumentRoot /var/www/html/site1

<Directory "/var/www/html/site1">

allow from all

Options +Indexes

</Directory>

ServerName www.site1.com

</VirtualHost>

<VirtualHost *:80>

DocumentRoot /var/www/html/site2

<Directory "/var/www/html/site2">

allow from all

Options +Indexes

</Directory>

ServerName www.site2.com

</VirtualHost>

  • 3 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.