Centos 7 builds virtual host multiple websites based on domain names

The first step, since I have configured the dns in advance, you can check my articles from the past few days. Then I add an IP address first.

vim /etc/sysconfig/network-scripts/ifcfg-ens33

Insert image description here
Restart the service. Make it effective.

systemctl restart network

Insert image description here
In the second step, add two more sites, web5 and web6 directories, and write the content respectively.

Insert image description here
The third step is to edit the forward file zheng. This is my custom name. You can also name it whatever you want. After entering, the conditional alias is recorded as follows.

Insert image description here
web5 CNAME www alias record web5 corresponds to www.

There are also reverse files, which are also recommended to be added.

Insert image description here
Just save and exit.

Then restart.

systemctl restart named

The fourth step is to test the dns configuration.

Insert image description here

The fifth step is to edit the previous vt.conf file.

vim /etc/httpd/conf.d/vt.conf

Add the following records.

Insert image description here

The sixth step is to restart the httpd service.

systemctl restart httpd

You can access it in step seven.

Insert image description here

Insert image description here

Guess you like

Origin blog.csdn.net/qq_51235445/article/details/125004584