Get the App
SLTechnology News&Howtos  ›  Servers  › 

Example Analysis of IP-based Virtual Host configuration of Apache Service in LAMP Architecture

Shulou Source: shulou.com Published: 2022-05-31 21:47:10 10月15日 Update

This article will explain in detail the example analysis of Apache service IP-based virtual host configuration in LAMP architecture. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Virtual Host configuration based on IP

IP-based virtual hosts-that is, each virtual host uses a separate IP address

The server can be configured with multiple network cards, or multiple IP implementations can be configured with the same network card.

Today, the simulated environment is that the same network card is configured with multiple IP addresses to realize the virtual host configuration based on IP.

1: add IP address

[root@Centos ~] # ifconfig eth0

Eth0 Link encap:Ethernet HWaddr 00:0C:29:AA:CA:2B

Inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0

Inet6 addr: fe80::20c:29ff:feaa:ca2b/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:2345 errors:0 dropped:0 overruns:0 frame:0

TX packets:694 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

RX bytes:224750 (219.4 KiB) TX bytes:92020 (89.8 KiB)

Add a new IP address to eth0 for testing

[root@Centos ~] # ifconfig eth0:20 192.168.1.20 netmask 255.255.255.0 up

[root@Centos ~] # ifconfig

Eth0 Link encap:Ethernet HWaddr 00:0C:29:AA:CA:2B

Inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0

Inet6 addr: fe80::20c:29ff:feaa:ca2b/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:2468 errors:0 dropped:0 overruns:0 frame:0

TX packets:767 errors:0 dropped:0 overruns:0 carrier:0

Collisions:0 txqueuelen:1000

RX bytes:235882 (230.3 KiB) TX bytes:100158 (97.8 KiB)

Eth0:20 Link encap:Ethernet HWaddr 00:0C:29:AA:CA:2B

Inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

Two: connectivity testing

Test connectivity on the local client host

C:\ Users\ Administrator > ping 192.168.1.20

Ping 192.168.1.20 has 32 bytes of data:

Reply from 192.168.1.20: bytes = 32 time

Tags: Configuration host virtual host service byte time test address multiple file article network card architecture example analysis customer client data more environment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Huawei Apple Shulou Information Microsoft