Get the App
SLTechnology News&Howtos  ›  Servers  › 

The second bullet of Linux subscription Apache service (based on IP and domain name)

Shulou Source: shulou.com Published: 2022-06-02 04:53:03 10月20日 Update

Then the first play of Apache service (https://blog.51cto.com/14451009/2444673),) continues to introduce Apache software.

The previous article introduced the configuration of a simple Apache virtual host and creating multiple websites based on the same IP address of the port. This article mainly introduces how to create different websites based on domain names and different IP addresses.

The first step is to add a network card to the VMware virtual machine.

Now there are two IP addresses, one is 192.168.220.146 and the other is 192.168.220.130

It is still the configuration file of the first bullet. Just make some changes here.

Then use the httpd-t command to see if there are any errors in the syntax of the configuration file. Restart the httpd service after no errors.

The input of 192.168.220.146 here is the content of the demo.com created at the beginning, while the input of 192.168.220.130 is the content of the ABC website, which successfully realizes the creation of different websites based on IP addresses.

The last thing to introduce is to create different websites based on domain names, which need to be accompanied by a DNS domain name resolution service.

First of all, we need to download and install a service package for bind, that is, DNS domain name resolution.

Open the main configuration file of DNS, modify the listening address and allow access address to ask any, and save exit.

Next, configure the zone configuration file, the path is / etc/named.rfc1912.zones, and then create two zones, one for parsing demo.com and one for parsing abc.com

`

Next, move to the / var/named directory and copy out the two configuration files you just created.

Add the hostname www at the end of the demo.com.zone file and resolve the address 192.168.220.146

Add the hostname www at the end of the abc.com.zone file, resolve the address 192.168.220.130, and then start the DNS domain name resolution service.

Then modify the address text of the local DNS server.

Test whether the two domain names can be successfully resolved, this side has been able to successfully resolve.

Then modify the DNS service of the Windows system for testing to the local DNS server address, and then use the nslookup command to test whether it can be parsed successfully.

This side has successfully parsed out the two domain name websites that they have just created.

Enter two different domain names here and visit different websites.

Tags: Address domain name service file website configuration different two success zone host test input next content command server end error that is Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Microsoft Shulou Tech Info vpn MySQL