How Can I Set Up IP-Based Virtual Hosting?
In IP-based virtual hosting, one IP address is dedicated to one virtual host (though one virtual host may have multiple IPs). This allows you to visit a virtual host with a URL like “http://192.168.0.1/index.html”.
Follow the steps below to set up IP-based virtual hosting:
1. Allocate at least one IP address for each website you plan to host. This is not a LiteSpeed Web Server configuration. TIP: You can create an IP alias to assign multiple IPs to one network adapter.
2. Configure DNS properly. Assign each domain name to its corresponding IP address. This is commonly done by adding an “A” name entry to the DNS zone file for the website. This is not a LiteSpeed Web Server configuration.
3. Create listeners in the WebAdmin console. (Configuration > Listeners > Add)
You have two choices:
- Create one listener that listens on all IPs and configure virtual host mappings to share that one listener as detailed in the name-based hosting wiki.
- Create one listener for each IP. Since each IP address should only map to one virtual host, these listeners do not need to have domain names specified in their virtual host mappings. They can be easily assigned to their corresponding virtual host by only mapping one virtual host in the Virtual Host Mappings table and using the wildcard domain name “*”.
Note: IP-based hosting can be a simpler organization structure if you already plan to give each website its own IP address.