大容量虚拟主机的动态配置
方法一:简单的 动态 虚拟 主机 代码: 这是 httpd.conf 文件中,完成 虚拟 主机 的 配置 方法,这里采用了 mod_vhost_alias 。 # 从 Host: 头中取得服务器名字 Server Name UseCanonicalName Off # 这里的日志格式,可以在将来通过第一个参数域来分隔不同的 虚
方法一:简单的动态虚拟主机代码:
这是 httpd.conf 文件中,完成虚拟主机的配置方法,这里采用了 mod_vhost_alias 。
# 从 Host: 头中取得服务器名字 Server Name
UseCanonicalName Off
# 这里的日志格式,可以在将来通过第一个参数域来分隔不同的虚拟主机的日志
LogFormat "%V %h %l %u %t "%r" %s %b" vcommon
CustomLog logs/access_log vcommon
# 在返回请求的文件名的路径中包含进服务器名字: server name
VirtualDocumentRoot /虚拟主机空间根目录/%0/htdocs
VirtualScriptAlias /虚拟主机空间根目录/%0/cgi-bin
#需要首先建立 /%0/htdocs ,然后把文件放在htdocs才可以访问
#%0表示虚拟主机的Server Name的这个名字,例如www.net.cn
将 UseCanonicalName Off 的配置改为 UseCanonicalName DNS 即可实现基于 IP 地址的虚拟主机。而在文件路径中所要插入的服务器名字(server name) 则通过虚拟主机的 IP 地址解析而得。
方法二:多个的动态虚拟主机
代码:
UseCanonicalName Off
LogFormat "%V %h %l %u %t "%r" %s %b" vcommon
Options FollowSymLinks
AllowOverride All
Options FollowSymLinks
AllowOverride None
ServerName www.commercial.isp.com
CustomLog logs/access_log.commercial vcommon
VirtualDocumentRoot /www/commercial/%0/docs
VirtualScriptAlias /www/commercial/%0/cgi-bin
ServerName www.homepages.isp.com
CustomLog logs/access_log.homepages vcommon
VirtualDocumentRoot /虚拟主机空间根目录/%0/htdocs
VirtualScriptAlias /虚拟主机空间根目录/%0/cgi-bin
方法三:基于 IP 地址的虚拟主机
代码:
# 从 IP 地址反解析得到服务器名字(server name)
UseCanonicalName DNS
# 在日志中包含 IP 地址,便于后续分发
LogFormat "%A %h %l %u %t "%r" %s %b" vcommon
CustomLog logs/access_log vcommon
# 在文件路径中包含 IP 地址 %0表示IP
VirtualDocumentRootIP /www/hosts/%0/docs
VirtualScriptAliasIP /www/hosts/%0/cgi-bin
方法四:使用 mod_rewrite 的虚拟主机系统
代码:
RewriteEngine on
RewriteMap lowercase int:tolower
# 检查 hostname 正确与否,之后才能使 RewriteRule 起作用
RewriteCond ${lowercase:%{SERVER_NAME}} ^www\.[a-z-]+\.isp\.com$
# 将虚拟主机名字廉洁到 URI 的开头
# [C] 表明本次重写的结果将在下一个 rewrite 规则中使用
RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]
# 现在创建实际的文件名
RewriteRule ^www\.([a-z-]+)\.isp\.com/(.*) /home/$1/$2
重头戏
方法五:使用独立的虚拟主机配置文件
当你修改vhost.map的时候,不需要重新启动Apache
代码:
这样的布局利用了 mod_rewrite 的高级特性, 在独立的虚拟主机配置文件中转换。如此可以更为灵活,但需要较为复杂的设置。
vhost.map 文件包含了类似下面的内容:
www.customer-1.com /www/customers/1
www.customer-2.com /www/customers/2
#......
www.customer-N.com /www/customers/N
http.conf 包含了:
RewriteEngine on
RewriteMap lowercase int:tolower
# 定义映像文件
RewriteMap vhost txt:/VHOST.map的路径/vhost.map
# 和上面的例子一样,处理变名
RewriteCond %{REQUEST_URI} !^/icons/
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
# 这里做基于文件的重新映射
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/docs/$1
RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/cgi-bin/$1
引用:
以上内容来自Apache2的"动态配置大型虚拟主机",在这里列出来,是为了方便某些不想看文档的人参考一下子。
如果你去http://w.yi.org,使用关键字 虚拟主机 搜索一下子,相信会有更多的资料

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Unfortunately, people often delete certain contacts accidentally for some reasons. WeChat is a widely used social software. To help users solve this problem, this article will introduce how to retrieve deleted contacts in a simple way. 1. Understand the WeChat contact deletion mechanism. This provides us with the possibility to retrieve deleted contacts. The contact deletion mechanism in WeChat removes them from the address book, but does not delete them completely. 2. Use WeChat’s built-in “Contact Book Recovery” function. WeChat provides “Contact Book Recovery” to save time and energy. Users can quickly retrieve previously deleted contacts through this function. 3. Enter the WeChat settings page and click the lower right corner, open the WeChat application "Me" and click the settings icon in the upper right corner to enter the settings page.

Tomato Novel is a very popular novel reading software. We often have new novels and comics to read in Tomato Novel. Every novel and comic is very interesting. Many friends also want to write novels. Earn pocket money and edit the content of the novel you want to write into text. So how do we write the novel in it? My friends don’t know, so let’s go to this site together. Let’s take some time to look at an introduction to how to write a novel. Share the Tomato novel tutorial on how to write a novel. 1. First open the Tomato free novel app on your mobile phone and click on Personal Center - Writer Center. 2. Jump to the Tomato Writer Assistant page - click on Create a new book at the end of the novel.

When creating a virtual machine, you will be asked to select a disk type, you can select fixed disk or dynamic disk. What if you choose fixed disks and later realize you need dynamic disks, or vice versa? Good! You can convert one to the other. In this post, we will see how to convert VirtualBox fixed disk to dynamic disk and vice versa. A dynamic disk is a virtual hard disk that initially has a small size and grows in size as you store data in the virtual machine. Dynamic disks are very efficient at saving storage space because they only take up as much host storage space as needed. However, as disk capacity expands, your computer's performance may be slightly affected. Fixed disks and dynamic disks are commonly used in virtual machines

Mobile games have become an integral part of people's lives with the development of technology. It has attracted the attention of many players with its cute dragon egg image and interesting hatching process, and one of the games that has attracted much attention is the mobile version of Dragon Egg. To help players better cultivate and grow their own dragons in the game, this article will introduce to you how to hatch dragon eggs in the mobile version. 1. Choose the appropriate type of dragon egg. Players need to carefully choose the type of dragon egg that they like and suit themselves, based on the different types of dragon egg attributes and abilities provided in the game. 2. Upgrade the level of the incubation machine. Players need to improve the level of the incubation machine by completing tasks and collecting props. The level of the incubation machine determines the hatching speed and hatching success rate. 3. Collect the resources required for hatching. Players need to be in the game

Setting font size has become an important personalization requirement as mobile phones become an important tool in people's daily lives. In order to meet the needs of different users, this article will introduce how to improve the mobile phone use experience and adjust the font size of the mobile phone through simple operations. Why do you need to adjust the font size of your mobile phone - Adjusting the font size can make the text clearer and easier to read - Suitable for the reading needs of users of different ages - Convenient for users with poor vision to use the font size setting function of the mobile phone system - How to enter the system settings interface - In Find and enter the "Display" option in the settings interface - find the "Font Size" option and adjust it. Adjust the font size with a third-party application - download and install an application that supports font size adjustment - open the application and enter the relevant settings interface - according to the individual

According to news from this site on July 23, Lenovo’s YOGA Portal high-performance desktop computer, which has been exposed for a long time, is now confirmed to be officially released at ChinaJoy in Shanghai on July 27. It is claimed to be a mini host designed for professional AI creation. It is a performance master and an expert in AI creation of 3D digital people. The AI virtual background is based on the on-site pictures provided by our friend @yuP in Shanghai. The volume of this small host is only 3.7L. It is made of anodized aluminum and is equipped with Intel Core. i7-14700 processor, equipped with 32GBDDR5 memory and 1TB solid state drive. YOGA Portal is both a host and an all-in-one AI creation machine. The high-performance host is combined with an algorithm-optimized camera to form an integrated solution. Just stand in front of the camera i.e.

According to news from this site on June 5, MSI participated in the 2024 Taipei International Computer Show and showcased a new flagship gaming computer called MEGVisionXAI. This game console is an extension of the existing Vision series and uses a very eye-catching surround glass design, with internal components clearly visible. The most attractive part is that the front of the host is equipped with an oversized touch screen. MSI staff said that it can synchronize MSI’s exclusive AI applications to further enhance various AI functions. The relevant pictures attached to this site are as follows: MSI has not yet explained more details. From the pictures shared, you can see that a local AI chatbot is running on the screen. Users can interact with it and ask it to complete AI tasks and locate locally stored documents. wait. Source of the above picture:

The difference between Go language methods and functions lies in their association with structures: methods are associated with structures and are used to operate structure data or methods; functions are independent of types and are used to perform general operations.
