In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail how to configure virtual hosts based on apache based on ip. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
First, we use notepad to open the httpd.conf file, which is located in the apache directory, such as D:\ AppServ\ Apache2.2\ conf, and modify the following two points:
(recommended study: apache from beginner to proficiency)
LoadModule vhost_alias_module modules/mod_vhost_alias.so / / remove the preceding #, which means to enable the virtual host function of apache, and line 203 Include conf/extra/httpd-vhosts.conf / / remove # means to import the virtual host configuration from the file httpd-vhosts.conf
After configuring the virtual host, you can't access it with localhost. You just need to comment out the ServerName localhost:80 line of the httpd.conf file.
Based on IP
1. Suppose the server has an IP address of 192.168.1.10, and use ifconfig to bind 3 IP on the same network interface eth0:
[root@localhost root] # ifconfig eth0:1 192.168.1.11 [root@localhost root] # ifconfig eth0:2 192.168.1.12 [root@localhost root] # ifconfig eth0:3 192.168.1.13
2. Modify the hosts file and add three domain names corresponding to it:
192.168.1.11 www.test1.com192.168.1.12 www.test2.com192.168.1.13 www.test3.com
3. Set up a virtual host to store the root directory of the web page, such as test1, test2 and test3 folders under the / www directory, where 1.html, 2.html and 3.html are stored respectively.
/ www/test1/1.html/www/test2/2.html/www/test3/3.html
4. Include the additional configuration file httpd-vhosts.conf in httpd.conf, and then write the following configuration in httpd-vhosts.conf:
ServerName www.test1.com DocumentRoot / www/test1/ Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow From All ServerName www.test1.com DocumentRoot / www/test2/ Options Indexes FollowSymLinks AllowOverride None Order allow Deny Allow From All ServerName www.test1.com DocumentRoot / www/test3/ Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow From All on how to configure virtual hosts for apache based on ip, that's all. I hope the above content can be of some help to you and 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.