Re: 1 IP with multiple sites

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Sep 7, 2007, at 4:49 PM, Chris Arnold wrote:

Sorry for the top-posting....

That's OK, we can break that nasty habit for you.

I have made a vhost.conf file, like so:
NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin email@xxxxxxxxxxx
    ServerName name.domain.tld
    ServerAlias domain.tld name.domain.tld
    DocumentRoot /path/to/root/folder

</VirtualHost> or else Apache won't start.


Starting httpd2 (prefork) [Fri Sep 07 19:41:01 2007] [warn] NameVirtualHost *:80 has no VirtualHosts

To clarify what i have done: i made a different vhost.conf (in /etc/ apache2/vhost.d/new-file.conf) file like so:
NameVirtualHost *:80

You only need one of these in your entire configuration. Neither should it do you any harm to have two, it's just redundant. To respond to your other post, it doesn't matter where directives like that go because I assume the vhost.d files get sucked in with Include.

<VirtualHost *:80>
    ServerAdmin email@xxxxxxxxxxx
    ServerName differentname.domain.tld
    ServerAlias domain.tld differentname.domain.tld
    DocumentRoot /path/to/root/folder

I have also tried to combine this vhost conf into the one that works. when doing this, i do not get that error on restart of apache2 but i do not see the correct site. What am i doing wrong? Am i making the correct conf files in the right file or should it be made in httpd? Thanks for everything

That depends on who designed your configuration file layout and how the Include statement picks up the extra config files. Use httpd -S to check which vhosts you have. Use httpd -h to find out what flags it knows. (:

To access a name-based vhost, you have to supply the right Host: header. Browsers are very limited about this, and basically only send whatever you put in the location textfield. Better to test with curl:

curl -i -H "Host: name.domain.tld" http://<name-or-ip-address>/...

(should see name site)

curl -i -H "Host: differentname.domain.tld" http://<name-or-ip- address/...

(should see differentname site)

See also the chapter on virtual host name matching. You can put a tag (%v off the top of my head) in your LogFormat and Apache will print the name of the matched vhost to the log file.

S.

--
Sander Temme
sctemme@xxxxxxxxxx
PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF



Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux