Three implementation methods of apache 2.4 virtual host in centos Environment

Source: Internet
Author: User

Three implementation methods of apache 2.4 virtual host in centos Environment
You cannot use apache, Zookeeper, or virtual machine in the production environment!
Method 1: Based on IP IP1: 80 IP2: 80 Method 2: Based on port IP: 80 IP: 8080 method 3: Based on Domain Name IP: 80 host name different www.abcd.com www.efgh.com

1. Configure the second address [root @ localhost ~] Based on IP address 1 # Cd/etc/sysconfig/network-scripts/[root @ localhostnetwork-scripts] # cpifcfg-eth0ifcfg-eth0: 0


[Root @ localhostnetwork-scripts] # servicenetworkrestart


2. Configure http. conf and add the following line # Virtualhosts Include/etc/httpd/extra/httpd-vhosts.conf
3. Configure httpd-vhosts.conf


4. Create a web directory a.org and zjj


5. Create a webpage File


6. Use elinks to open the webpage [root @ localhosthtdocs] # elinkshttp: // 192.168.1.135


[Root @ localhosthtdocs] # elinkshttp: // 192.168.1.136


2. Based on the port (Note: iptables allows port 8080) 1. Modify httpd. conf


2. Modify httpd-vhosts.conf


3. Create a webpage directory and a webpage File


4. Test [root @ localhosthtdocs] # elinkshttp: // 192.168.1.135


[Root @ localhosthtdocs] # elinkshttp: // 192.168.1.135: 8080

3. If I see blank content based on the domain name, I must be too lazy .. You only need to modify the hosts file so that the domain name can be resolved.

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.