Three implementation methods of apache 2.4 virtual host in centos Environment
You cannot use apache, Zookeeper, or virtual machine in the production environment!
Method 1: Based on IP IP1: 80 IP2: 80 Method 2: Based on port IP: 80 IP: 8080 method 3: Based on Domain Name IP: 80 host name different www.abcd.com www.efgh.com
1. Configure the second address [root @ localhost ~] Based on IP address 1 # Cd/etc/sysconfig/network-scripts/[root @ localhostnetwork-scripts] # cpifcfg-eth0ifcfg-eth0: 0
[Root @ localhostnetwork-scripts] # servicenetworkrestart
2. Configure http. conf and add the following line # Virtualhosts Include/etc/httpd/extra/httpd-vhosts.conf
3. Configure httpd-vhosts.conf
4. Create a web directory a.org and zjj
5. Create a webpage File
6. Use elinks to open the webpage [root @ localhosthtdocs] # elinkshttp: // 192.168.1.135
[Root @ localhosthtdocs] # elinkshttp: // 192.168.1.136
2. Based on the port (Note: iptables allows port 8080) 1. Modify httpd. conf
2. Modify httpd-vhosts.conf
3. Create a webpage directory and a webpage File
4. Test [root @ localhosthtdocs] # elinkshttp: // 192.168.1.135
[Root @ localhosthtdocs] # elinkshttp: // 192.168.1.135: 8080
3. If I see blank content based on the domain name, I must be too lazy .. You only need to modify the hosts file so that the domain name can be resolved.