Linux Web server (ii) Web hosting based on domain name, IP, port

Source: Internet
Author: User
Tags hosting web hosting

Linux Web server (ii)

1: Build a domain-based virtual host
First, set up a DNS server for two sites, and create a new zone, respectively: Www.goole.com and www.baidu.com
2) Modify the configuration file



3) Modify the data file



4) Restart the DNS service

5) Build Two websites

6: Preparing the Web page


7) Open the virtual host configuration file, modify the configuration file

8: Add the following content

9) Modify the master configuration file to enable the virtual host
vi/usr/local/httpd/conf/httpd.conf, remove the # # from the front.

10) Restart the HTTPD service

11) Accessing the virtual Web host on the client


So far, domain-based virtual hosting has been built.
Note: If you cannot access it on the client, it may be that the server's firewall is open or not, or the DNS service is not restarted, or the HTTPD service may not be restarted.


Case two: Build a virtual host based on different IP
1) Add two addresses to the server

2) Modify the resolved IP address in the DNS data file, Goole using 192.168.1.1,baidu 192.168.1.2

3) The Goole remains unchanged

4) Baidu: The following

5) Modify the virtual host configuration file

6) Restart HTTPD service
7) Clear the DNS cache before accessing website access on the client

8) Accessing the virtual Web host on the client

Case three: Port-based virtual host

1) Change the DNS data file "Goole" and "Baidu" in the IP of two URLs to the same 192.168.1.1

2) Modify the virtual host configuration file

3) Modify the httpd master configuration file vi/usr/local/httpd/conf/httpd.conf

4) Restart the HTTPD service
5) Accessing the virtual Web site on the client

















Linux Web server (ii) Web hosting based on domain name, IP, port

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.