Apache virtual directory and multi-port multiple host name configuration

Source: Internet
Author: User

Overview:
Virtual directory: Refers to the establishment of a virtual subdirectory under the site, specifying a fixed physical path as the site's application path. Each Internet service can be published from multiple catalogs. A virtual server can have a host directory and any number of other publishing directories. Other publishing directories are called virtual directories.
The virtual host is divided into:
1. Domain-based virtual host (same IP and port for different domains)
Provide the domain name of the virtual Web site to the DNS service so that when you access any of these virtual Web sites, you end up accessing the same IP address.
2. Port-based virtual host (same IP on different ports)
Typically used only for the same Web site, the names and IP addresses of their sites are often the same, but different TCP ports provide access to different Web content. When you access a Web server that is not a 80 port in a browser, you need to explicitly indicate the port number of the server.
Experimental steps:
(i). Virtual directory
1. See if httpd installs and view httpd.conf's master profile

2. Modify the Listen listener address and servername domain name in the/etc/httpd/conf/httpd.conf master configuration file


3. Start the httpd service and turn off the firewall and enhanced security features

4. Switch to/ETC/HTTPD/CONF.D and create the virtual directory test in the vdir.conf configuration file.

5. Enter mkdir/opt/test Create test directory and switch to/opt directory, write echo "This is VDir test" >/opt/test/index.html

6. Restart the HTTPD service, open the browser input 192.168.100.100/test for verification


7. Enter the Vdir.conf profile to turn on user authentication and set the user password


8. Restart the HTTPD service to open the browser for verification.


(b). Different domain names are the same IP, port.
1. Create the host.conf file in the etc/httpd/conf.d/directory to create the domain name Benet, ACCP, respectively in the host file.

2. Create the Site directory, switch to the/OPT directory in the Benet, ACCP the first page to write this is ACCP and this is Benet.

3. Set up DNS service for Domain name resolution, install BIND package.

4. Edit the Master profile vim/etc/named.conf, modify the listening address and set all the network segments to parse.

5. Edit the Zone profile Vim/etc/named.rfc1912.zones

6. Switch to the/var/named/directory and leave the original file properties to copy the Zone data configuration template named.localhost to Benet.com.zone, accp.com.zone configuration file, and edit them separately.



7. Start the named service and restart the HTTPD service for resolution verification


(iii). Same IP on different ports
1. Switch to the/etc/httpd/conf.d/directory and insert 8080 ports in the host.conf file.


2. Create the Site Directory benet01, switch to the/OPT directory

3. Edit the/etc/httpd/conf/httpd.conf configuration file, add the listening address and port 8080.

4. Restart the HTTPD service and view the port information

5. Enter www.benet.com:8080 on the browser to verify

Apache virtual directory and multi-port multiple host name configuration

Related Article

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.