apache: create virtual host based on port Take creating virtual hosts (a, b, c) as an example 1) 2.1.2 Disable the default host mode [root@localhost httpd]# vim /etc/httpd/conf/httpd.conf Comment out the following line in the main configuration file #DocumentRoot "/var/www/html" 2) Add the listening port in the main configuration file Find the Listen line and add a line Listen 8080 based on the original line Listen 80 Listen 81 3) Add port configuration virtual [root@localhost httpd]#vim /etc/httpd/conf.d/virtualhost.conf <VirtualHost 192.168.87.131:80> DocumentRoot "/var/www/a" ServerName www.a.com </VirtualHost> <VirtualHost 192.168.87.131:8080> DocumentRoot "/var/www/b" ServerName www.b.com </VirtualHost> <VirtualHost 192.168.87.131:81 DocumentRoot "/var/www/c" ServerName www.c.com </VirtualHost> 4) Create a new directory [root@localhost conf.d]# cd /var/www [root@localhost www]# mkdir abc [root@localhost www]# echo welcome to www.a.com >> ./a/index.html [root@localhost www]# echo welcome to www.b.com >> ./b/index.html [root@localhost www]# echo welcome to www.c.com >> ./c/index.html 5) Restart httpd [root@localhost ~]#systemctl restart httpd Note: Be sure to restart httpd!!! Final result: This is the end of this article about examples of creating virtual hosts based on Apache ports. For more information about creating virtual hosts based on Apache ports, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: CSS Reset style reset implementation example
>>: Vue multi-page configuration details
In actual projects, the up and down scroll bars a...
Object's hasOwnProperty() method returns a Bo...
1. Introduction When we are writing a page, we so...
Detailed example of getting the maximum value of ...
This article example shares the specific code for...
I have always been interested in wireless interac...
1. The significance of persistent statistical inf...
Table of contents Join syntax: 1. InnerJOIN: (Inn...
Let's take a look at ufw (Uncomplicated Firew...
Table of contents Why do we need a material libra...
Table of contents 1. Function Introduction 2. Key...
Docker Compose can realize the orchestration of D...
Effect Fading from top to bottom Source code html...
Timer Effects: <div> <font id='timeC...
When building a database and writing a program, i...