Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report