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
Each of these 16 sites is worth reading carefully,...
In this article, I will explain the relevant cont...
1 Question The company's server uses Apache, ...
Table of contents 1. Install and import 2. Define...
This article describes the example of MySQL sched...
Table of contents verify: Combined with the examp...
First find out where the configuration file is wh...
Recently, I used vuethink in my project, which in...
In MySQL, we usually use limit to complete the pa...
Development Background: Recently, I am working on...
The execution efficiency of MySQL database has a ...
Table of contents Preface Introduction to Bezier ...
Because the Raspberry Pi is based on ARM architec...
Copy code The code is as follows: <select> ...
All-round system monitoring tool dstat dstat is a...