简体   繁体   中英

name-based virtual hosting in Apache

I'd like to set up name-based virtual hosting in Apache, but I don't have DNS name (local private network). Thus I want to get something like that:

http://192.168.0.1/wiki - First virtual host - wiki.
http://192.168.0.1/redmine - Second virtual host - redmine.

As I suggest I can be achievable by using ServerName option in section of both vhosts. But in Apache documentation has no mention that I can use for FQDN IP-addr. Is it possible? How can I reach my wishes? PS: I want to share my sites on the same subnet only. Thus any who can ping me can enter http://my_ip/wiki and get wiki, http://my_ip/redmine and get redmine.

You can host multiple websites on localhost if you enter them in your local hosts file:

It is under Windows in c:\\Windows\\System32\\drivers\\etc\\ . In Linux and Unix systems typically in \\etc\\ .

The format is very simple hostname a spacer and the ip address:

127.0.80.1  phpmyadmin.local
127.0.80.2  joomla.local
127.0.80.3  drupal.local

If you want to access that domains via network you need access to a DNS server. Depending on your router (a fritzbox will block that) you could also use dyndns , but you must know that this will only work in your local network.

In case of usage a DNS server need to use the local network ip like 192.168.0.1 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM