In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces you how to use apache to configure virtual hosts, the content is very detailed, interested friends can refer to, hope to be helpful to you.
Apache source code installation depends on apr
Apr update
1. Backup
Mv / etc/yum.repos.d/CentOS-Base.repo / etc/yum.repos.d/CentOS-Base.repo.backup
2. Download CentOS-Base.repo to / etc/yum.repos.d/
Cd / etc/yum.repos.d/
Wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
3. Generate cache
Yum clean all
Yum makecache
4. Update the system
Yum update
Install apr and other library files
Yum install apr*
There are three ways to realize Apache virtual host.
Virtual Host based on IP
Port-based virtual host
Virtual host based on domain name
Disable the default host mode
Comment on the following line
# DocumentRoot "/ var/www/html"
1. Virtual host configuration based on IP
Add multiple IP for the host
Ip addr add 192.168.137.201/24 dev eth0
Add virtual host profile
Vim / etc/httpd/conf/extra/httpd-vhost.conf
DocumentRoot "/ var/www/test200"
ServerName www.test200.com
DocumentRoot "/ var/www/test201"
ServerName www.test201.com
Create a directory test200 test201 under / var/www/
Create a home page with IP 200,201
2. Port-based virtual host configuration
Based on the original line Listen 80, add one line
Listen 8080
DocumentRoot "/ var/www/test200"
ServerName www.test200.com
# the following is added on the basis of the above configuration.
DocumentRoot "/ var/www/test200-8080"
ServerName www.test200-8080.com
Create a directory under / var/www/ test200-8080
Create a home page with an IP of 200-8080
3. Virtual host configuration based on domain name
DocumentRoot "/ var/www/html/kgccom"
ServerName www.kgc.com
ErrorLog "logs/www.kgc.com.error_log"
CustomLog "logs/www.kgc.com.access_log" common
< Directory "/var/www/html" >Require all granted
DocumentRoot "/ var/www/html/kccecom"
ServerName www.kcce.com
Note: refer to the vhost.conf configuration file and uncomment in the main configuration file
On how to use apache to configure virtual hosts to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.