Maison >développement back-end >tutoriel php >ApacheReferenceManual12_PHP教程
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. Youll 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_proxys 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