Apache configuration for Port/IP-based virtual hosts

Source: Internet
Author: User

Apache Optimization:
Modify configuration file: httpd.conf

The version number is not displayed:

Description: In general, the use of site points, advantages: security
Port-based virtual Host: (Add a listening port in the following two profiles)
Master configuration file:/application/apache/conf/httpd.conf
Extension Profile:/application/apache/conf/extra/httpd-vhosts.conf
:/listen
1. Use the Vim editor to search for listen and add ports below listen 80

2. Then return to the virtual host profile of the site before you configure it
PS: If you are adding a site to the master profile, return to the main profile httpd.conf
Similarly, if the site configuration is in the extension configuration file, return to the httpd-vhosts.conf
The following is an example of a httpd-vhosts.conf file: (need to add port name and assign port)
:/namevirtualhost *:80
Search for Namevirtualhost, and add the previously configured listening port information (adding port name) below

Then assign the port to the desired site: (Assigning a port number to the site)

After configuration,: Wq Save and exit,
Then check the syntax and restart the Apache service
/application/apache/bin/apachectl-t
/application/apache/bin/apachectl Graceful

To configure a virtual host based on an IP address
    1. Configure an IP alias: (The following settings take effect temporarily)
      Ifconfig eno16777736:0 172.17.0.111/24 up

    2. Modify a site profile vim httpd-vhosts.conf
      Use the # number to comment out the previously configured port line.

      3. Assign the IP address to the specified site and restore the listening port to: 80

      4. Last: Wq Save and exit, check syntax and restart Apache

      5. Enter the IP address in the browser to see if the site is configured successfully.

Apache configuration for Port/IP-based virtual hosts

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.