频道直达 - 学院 - 下载 - 交易 - 特效 - 字库 - 手册 -排名-工具- 繁體
网页教学网站开发 设为首页
加入收藏
联系我们
建站搜索: 常用广告代码   用户注册 | 用户登陆
您当前的位置:中国建站之家 -> 网站开发设计技术教程 -> PHP教程 -> Apache Reference Manual (12)

Apache Reference Manual (12)

作者:未知  来源:转载  发布时间:2005-7-21 10:33:58  发布人:acx

减小字体 增大字体

UseCanonicalName directive
Syntax: UseCanonicalName on|off|dns
Default: UseCanonicalName on
Context: server config, virtual host, directory
Override: Options
Compatibility: UseCanonicalName is only available in Apache 1.3 and later
In many situations Apache has to construct a self-referential URL. That is, a URL which refers back to the same server. With UseCanonicalName on (and in all versions prior to 1.3) Apache will use the ServerName and Port directives to construct a canonical name for the server. This name is used in all self-referential URLs, and for the values of SERVER_NAME and SERVER_PORT in CGIs.

With UseCanonicalName off Apache will form self-referential URLs using the hostname and port supplied by the client if any are supplied (otherwise it will use the canonical name). These values are the same that are used to implement name based virtual hosts, and are available with the same clients. The CGI variables SERVER_NAME and SERVER_PORT will be constructed from the client supplied values as well.

An example where this may be useful is on an intranet server where you have users connecting to the machine using short names such as www. You''ll notice that if the users type a shortname, and a URL which is a directory, such as http://www/splat, without the trailing slash then Apache will redirect them to http://www.domain.com/splat/. If you have authentication enabled, this will cause the user to have to reauthenticate twice (once for www and once again for www.domain.com). But if UseCanonicalName is set off, then Apache will redirect to http://www/splat/.

There is a third option, UseCanonicalName DNS, which is intended for use with mass IP-based virtual hosting to support ancient clients that do not provide a Host: header. With this option Apache does a reverse DNS lookup on the server IP address that the client connected to in order to work out self-referential URLs.

Warning: if CGIs make assumptions about the values of SERVER_NAME they may be broken by this option. The client is essentially free to give whatever value they want as a hostname. But if the CGI is only using SERVER_NAME to construct self-referential URLs then it should be just fine.

See also: ServerName, Port



--------------------------------------------------------------------------------

User directive
Syntax: User unix-userid
Default: User #-1
Context: server config, virtual host
Status: core
The User directive sets the userid as which the server will answer requests. In order to use this directive, the standalone server must be run initially as root. Unix-userid is one of:

A username
Refers to the given user by name.
# followed by a user number.
Refers to a user by their number.
The user should have no privileges which result in it being able to access files which are not intended to be visible to the outside world, and similarly, the user should not be able to execute code which is not meant for httpd requests. It is recommended that you set up a new user and group specifically for running the server. Some admins use user nobody, but this is not always possible or desirable. For example mod_proxy''s cache, when enabled, must be accessible to this user (see the CacheRoot directive).
Notes: If you start the server as a non-root user, it will fail to change to the lesser privileged user, and will instead continue to run as that original user. If you do start the server as root, then it is normal for the parent process to remain running as root.

Special note: Use of this directive in <VirtualHost> requires a properly configured suEXEC wrapper. When used inside a <VirtualHost> in this manner, only the user that CGIs are run as is affected. Non-CGI requests are still processed with the user specified in the main User directive.

SECURITY: Don''t set User (or Group) to root unless you know exactly what you are doing, and what the dangers are.



--------------------------------------------------------------------------------

<VirtualHost> directive
Syntax: <VirtualHost addr[:port] ...> ... </VirtualHost>
Context: server config
Status: Core.
Compatibility: Non-IP address-based Virtual Hosting only available in Apache 1.1 and later.
Compatibility: Multiple address support only available in Apache 1.2 and later.
<VirtualHost> and </VirtualHost> are used to enclose a group of directives which will apply only to a particular virtual host. Any directive which is allowed in a virtual host context may be used. When the server receives a request for a document on a particular virtual host, it uses the configuration directives enclosed in the <VirtualHost> section. Addr can be

The IP address of the virtual host
A fully qualified domain name for the IP address of the virtual host.
Example:
<VirtualHost 10.1.2.3>
ServerAdmin webmaster@host.foo.com
DocumentRoot /www/docs/host.foo.com
ServerName host.foo.com
ErrorLog logs/host.foo.com-error_log
TransferLog logs/host.foo.com-access_log
</VirtualHost>
Each VirtualHost must correspond to a different IP address, different port number or a different host name for the server, in the latter case the server machine must be configured to accept IP packets for multiple addresses. (If the machine does not have multiple network interfaces, then this can be accomplished with the ifconfig alias command (if your OS supports it), or with kernel patches like VIF (for SunOS(TM) 4.1.x)).
The special name _default_ can be specified in which case this virtual host will match any IP address that is not explicitly listed in another virtual host. In the absence of any _default_ virtual host the "main" server config, consisting of all those definitions outside any VirtualHost section, is used when no match occurs.

You can specify a :port to change the port that is matched. If unspecified then it defaults to the same port as the most recent Port statement of the main server. You may also specify :* to match all ports on that address. (This is recommended when used with _default_.)

SECURITY: See the security tips document for details on why your security could be compromised if the directory where logfiles are stored is writable by anyone other than the user that starts the server.

NOTE: The use of <VirtualHost> does not affect what addresses Apache listens on. You may need to ensure that Apache is listening on the correct addresses using either BindAddress or Listen.

See also: Apache Virtual Host documentation
See also: Warnings about DNS and Apache
See also: Setting which addresses and ports Apache uses
See also: How Directory, Location and Files sections work for an explanation of how these different sections are combined when a request is received

<end>

将本文收藏到QQ书签与更多好友分享
[打 印]
[] [返回上一页] [收 藏]
上一篇文章:Apache Reference Manual (2)
∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论...]
精彩推荐
热门文章
· 注册码大全二
· 注册码大全四
· 注册码大全一
· 要10G免费网络硬盘的请进..
· 通过google 赶快来赚美金..
· 注册码大全十
· 头像-qq头像(qq新头像)4..
· 让你轻松架设FTP服务器1..
· 注册码大全三
· 梦幻背景图片7
· 卡通动物图片6
· 网页制作素材-按钮素材2..
· 让你轻松架设FTP服务器5..
· 风景图片8
· 注册码大全九
· 让你轻松架设FTP服务器2..
关注此文读者还看过
· 奇幻视觉2
· 使用JScript.NET创建asp..
· 中华网收购北京一起玩网..
· ASP技巧:rs.getrows方法..
· 细细品味ASP.NET(四)
· Flash制作书法动画2
· FW MX 2004教程:界面(5)..
· 美IT网站首次成功上市 中..
· 代考网站危害巨大 网络监..
· 利用代理 打造网上教室
· 新写的一个定时新闻小偷..
· Alexa证实在中国与易比网..
· 视频搜索将成互联网下一..
· PHP 存取 MySQL 数据库的..
· 利用ASP生成EXECL文档
· 刷子工具
相关文章
· 联合国统计显示全球网民人数..
· 瞄准Apache IIS7向开源张开..
· 配置Apache服务器并且设置D..
· Windows下的 Apache + PHP ..
· Apache小技巧五则
· 中国招生录取网成立不到4个..
· Linux下Apache与Tomcat整合..
· 12家招嫖网站被责令整改
· PHP技巧:优化动态网页技术..
· 实现Java程序跨平台运行的1..
· PHP取GB2312编码字符串首字..
· 美12所高校加入Google图书数..
· 12家交友网站被责令整改
· Apache与Tomcat安装配置
· Apache2+Resin2.x集群配置实..
· 利用Apache+PHP3+MySQL建立..
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 人才招聘
网站合作、内容监督、商务咨询:QQ: 9576619
Copyright ? 2005--2008 中国建站之家版权所有
粤ICP备05092265号