Re: Virtual Hosts with one public IP

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

 



David Smith wrote:
> YES, I'd like to know more about it.

OK. I use IP-based virtual host (VH). My Apache conf has NameVirtualHost commented out by default, so just leave it as is.

#NameVirtualHost *

Each VH need a port, so I tell Apache to listen to those port.

  Listen 1111
  Listen 2222

In the VitualHost directive, put the IP or host name, following by a colon and a port number.
by host name:
<VirtualHost yourhostname:1111>
[somethings go here]
<VirtualHost yourhostname:2222>
or by IP:
<VirtualHost 123.123.123.123:1111>
[somethings go here]
<VirtualHost 123.123.123.123:2222>


Each VH needs a server name, and it could be host name or IP:

  ServerName yourhostname
or
  ServerName 123.123.123.123

Finally, save httpd.conf, do a "service httpd configtest". If it's OK, then (re)start your Apache service. The VH then can be accessed as:
- VH #1: http://yourhostname:1111 or http://123.123.123.123:1111
- VH #2: http://yourhostname:2222 or http://123.123.123.123:2222


Here's an example for all of the above steps:

Listen 1111
<VirtualHost 123.123.123.123:1111>
    ServerAdmin webmaster1@xxxxxxxxxxxxxxxxxxxxxx
    DocumentRoot /www/vhost1
    ServerName 123.123.123.123
    ErrorLog logs/vhost1-e
    CustomLog logs/vhost1-a common
</VirtualHost>

Listen 2222
<VirtualHost 123.123.123.123:2222>
    ServerAdmin webmaster2@xxxxxxxxxxxxxxxxxxxxxx
    DocumentRoot /www/vhost2
    ServerName 123.123.123.123
    ErrorLog logs/vhost1-e
    CustomLog logs/vhost1-a common
</VirtualHost>


> How DNS will resolve the addresses ?? Just as usual.


Thien



-- Shrike-list mailing list Shrike-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/shrike-list

[Index of Archives]     [Fedora Users]     [Centos Users]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat Phoebe Beta]     [Yosemite Forum]     [Fedora Discussion]     [Gimp]     [Stuff]     [Yosemite News]

  Powered by Linux