archive-com.com » COM » C » CAPITALSAFETY.COM

Total: 175

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Mapping URLs to Filesystem Locations - Apache HTTP Server
    are located Using the default setting of Userdir public html the above URL maps to a file at a directory like home user public html file html where home user is the user s home directory as specified in etc passwd There are also several other forms of the Userdir directive which you can use on systems where etc passwd does not contain the location of the home directory Some people find the symbol which is often encoded on the web as 7e to be awkward and prefer to use an alternate string to represent user directories This functionality is not supported by mod userdir However if users home directories are structured in a regular way then it is possible to use the AliasMatch directive to achieve the desired effect For example to make http www example com upages user file html map to home user public html file html use the following AliasMatch directive AliasMatch upages a zA Z0 9 home 1 public html 2 URL Redirection The configuration directives discussed in the above sections tell Apache to get content from a specific place in the filesystem and return it to the client Sometimes it is desirable instead to inform the client that the requested content is located at a different URL and instruct the client to make a new request with the new URL This is called redirection and is implemented by the Redirect directive For example if the contents of the directory foo under the DocumentRoot are moved to the new directory bar you can instruct clients to request the content at the new location as follows Redirect permanent foo http www example com bar This will redirect any URL Path starting in foo to the same URL path on the www example com server with bar substituted for foo You can redirect clients to any server not only the origin server Apache also provides a RedirectMatch directive for more complicated rewriting problems For example to redirect requests for the site home page to a different site but leave all other requests alone use the following configuration RedirectMatch permanent http www example com startpage html Alternatively to temporarily redirect all pages on one site to a particular page on another site use the following RedirectMatch temp http othersite example com startpage html Reverse Proxy Apache also allows you to bring remote documents into the URL space of the local server This technique is called reverse proxying because the web server acts like a proxy server by fetching the documents from a remote server and returning them to the client It is different from normal proxying because to the client it appears the documents originate at the reverse proxy server In the following example when clients request documents under the foo directory the server fetches those documents from the bar directory on internal example com and returns them to the client as if they were from the local server ProxyPass foo http internal example com bar ProxyPassReverse foo

    Original URL path: http://bc.capitalsafety.com/manual/urlmapping.html (2016-02-16)
    Open archived version from archive


  • Custom Error Responses - Apache HTTP Server
    9000 712 REDIRECT PATH bin usr local bin etc REDIRECT QUERY STRING REDIRECT REMOTE ADDR 121 345 78 123 REDIRECT REMOTE HOST ooh ahhh com REDIRECT SERVER NAME crash bang edu REDIRECT SERVER PORT 80 REDIRECT SERVER SOFTWARE Apache 0 8 15 REDIRECT URL cgi bin buggy pl Note the REDIRECT prefix At least REDIRECT URL and REDIRECT QUERY STRING will be passed to the new URL assuming it s a cgi script or a cgi include The other variables will exist only if they existed prior to the error problem None of these will be set if your ErrorDocument is an external redirect anything starting with a scheme name like http even if it refers to the same host as the server Configuration Use of ErrorDocument is enabled for htaccess files when the AllowOverride is set accordingly Here are some examples ErrorDocument 500 cgi bin crash recover ErrorDocument 500 Sorry our script crashed Oh dear ErrorDocument 500 http xxx ErrorDocument 404 Lame excuses not found html ErrorDocument 401 Subscription how to subscribe html The syntax is ErrorDocument 3 digit code action where the action can be Text to be displayed Prefix the text with a quote Whatever follows the quote is displayed Note the prefix isn t displayed An external URL to redirect to A local URL to redirect to Custom Error Responses and Redirects Apache s behavior to redirected URLs has been modified so that additional environment variables are available to a script server include Old behavior Standard CGI vars were made available to a script which has been redirected to No indication of where the redirection came from was provided New behavior A new batch of environment variables will be initialized for use by a script which has been redirected to Each new variable will have the

    Original URL path: http://bc.capitalsafety.com/manual/custom-error.html (2016-02-16)
    Open archived version from archive

  • Log Files - Apache HTTP Server
    server will try to determine the hostname and log it in place of the IP address However this configuration is not recommended since it can significantly slow the server Instead it is best to use a log post processor such as logresolve to determine the hostnames The IP address reported here is not necessarily the address of the machine at which the user is sitting If a proxy server exists between the user and the server this address will be the address of the proxy rather than the originating machine l The hyphen in the output indicates that the requested piece of information is not available In this case the information that is not available is the RFC 1413 identity of the client determined by identd on the clients machine This information is highly unreliable and should almost never be used except on tightly controlled internal networks Apache httpd will not even attempt to determine this information unless IdentityCheck is set to On frank u This is the userid of the person requesting the document as determined by HTTP authentication The same value is typically provided to CGI scripts in the REMOTE USER environment variable If the status code for the request see below is 401 then this value should not be trusted because the user is not yet authenticated If the document is not password protected this entry will be just like the previous one 10 Oct 2000 13 55 36 0700 t The time that the request was received The format is day month year hour minute second zone day 2 digit month 3 letter year 4 digit hour 2 digit minute 2 digit second 2 digit zone 4 digit It is possible to have the time displayed in another format by specifying format t in the log format string where format is as in strftime 3 from the C standard library GET apache pb gif HTTP 1 0 r The request line from the client is given in double quotes The request line contains a great deal of useful information First the method used by the client is GET Second the client requested the resource apache pb gif and third the client used the protocol HTTP 1 0 It is also possible to log one or more parts of the request line independently For example the format string m U q H will log the method path query string and protocol resulting in exactly the same output as r 200 s This is the status code that the server sends back to the client This information is very valuable because it reveals whether the request resulted in a successful response codes beginning in 2 a redirection codes beginning in 3 an error caused by the client codes beginning in 4 or an error in the server codes beginning in 5 The full list of possible status codes can be found in the HTTP specification RFC2616 section 10 2326 b The last entry indicates the size of the object returned to the client not including the response headers If no content was returned to the client this value will be To log 0 for no content use B instead Combined Log Format Another commonly used format string is called the Combined Log Format It can be used as follows LogFormat h l u t r s b Referer i User agent i combined CustomLog log access log combined This format is exactly the same as the Common Log Format with the addition of two more fields Each of the additional fields uses the percent directive header i where header can be any HTTP request header The access log under this format will look like 127 0 0 1 frank 10 Oct 2000 13 55 36 0700 GET apache pb gif HTTP 1 0 200 2326 http www example com start html Mozilla 4 08 en Win98 I Nav The additional fields are http www example com start html Referer i The Referer sic HTTP request header This gives the site that the client reports having been referred from This should be the page that links to or includes apache pb gif Mozilla 4 08 en Win98 I Nav User agent i The User Agent HTTP request header This is the identifying information that the client browser reports about itself Multiple Access Logs Multiple access logs can be created simply by specifying multiple CustomLog directives in the configuration file For example the following directives will create three access logs The first contains the basic CLF information while the second and third contain referer and browser information The last two CustomLog lines show how to mimic the effects of the ReferLog and AgentLog directives LogFormat h l u t r s b common CustomLog logs access log common CustomLog logs referer log Referer i U CustomLog logs agent log User agent i This example also shows that it is not necessary to define a nickname with the LogFormat directive Instead the log format can be specified directly in the CustomLog directive Conditional Logs There are times when it is convenient to exclude certain entries from the access logs based on characteristics of the client request This is easily accomplished with the help of environment variables First an environment variable must be set to indicate that the request meets certain conditions This is usually accomplished with SetEnvIf Then the env clause of the CustomLog directive is used to include or exclude requests where the environment variable is set Some examples Mark requests from the loop back interface SetEnvIf Remote Addr 127 0 0 1 dontlog Mark requests for the robots txt file SetEnvIf Request URI robots txt dontlog Log what remains CustomLog logs access log common env dontlog As another example consider logging requests from english speakers to one log file and non english speakers to a different log file SetEnvIf Accept Language en english CustomLog logs english log common env english CustomLog logs non english log common env english Although

    Original URL path: http://bc.capitalsafety.com/manual/logs.html (2016-02-16)
    Open archived version from archive

  • logresolve - Resolve IP-addresses to hostnames in Apache log files - Apache HTTP Server
    This means that each IP number will only be looked up the first time it is found in the log file Takes an Apache log file on standard input The IP addresses must be the first thing on each line and must be separated from the remainder of the line by a space Synopsis Options Synopsis logresolve s filename c access log access log new Options s filename Specifies a

    Original URL path: http://bc.capitalsafety.com/manual/programs/logresolve.html (2016-02-16)
    Open archived version from archive

  • mod_so - Apache HTTP Server

    (No additional info available in detailed archive for this subpage)
    Original URL path: /manual/mod/mod_so.html (2016-02-16)


  • apachectl - Apache HTTP Server Control Interface - Apache HTTP Server
    on success and 0 if an error occurs For more details view the comments in the script Synopsis Options See also Starting Apache Stopping Apache Configuration Files Platform Docs httpd Synopsis When acting in pass through mode apachectl can take all the arguments available for the httpd binary apachectl httpd argument When acting in SysV init mode apachectl takes simple one word commands defined below apachectl command Options Only the SysV init style options are defined here Other arguments are defined on the httpd manual page start Start the Apache httpd daemon Gives an error if it is already running This is equivalent to apachectl k start stop Stops the Apache httpd daemon This is equivalent to apachectl k stop restart Restarts the Apache httpd daemon If the daemon is not running it is started This command automatically checks the configuration files as in configtest before initiating the restart to make sure the daemon doesn t die This is equivalent to apachectl k restart fullstatus Displays a full status report from mod status For this to work you need to have mod status enabled on your server and a text based browser such as lynx available on your system The URL used to access the status report can be set by editing the STATUSURL variable in the script status Displays a brief status report Similar to the fullstatus option except that the list of requests currently being served is omitted graceful Gracefully restarts the Apache httpd daemon If the daemon is not running it is started This differs from a normal restart in that currently open connections are not aborted A side effect is that old log files will not be closed immediately This means that if used in a log rotation script a substantial delay may be necessary to

    Original URL path: http://bc.capitalsafety.com/manual/programs/apachectl.html (2016-02-16)
    Open archived version from archive

  • Apache Virtual Host documentation - Apache HTTP Server
    running on each IP address The fact that they are running on the same physical server is not apparent to the end user Apache was one of the first servers to support IP based virtual hosts right out of the box Versions 1 1 and later of Apache support both IP based and name based virtual hosts vhosts The latter variant of virtual hosts is sometimes also called host based or non IP virtual hosts Below is a list of documentation pages which explain all details of virtual host support in Apache version 1 3 and later Virtual Host Support Configuration directives See also mod vhost alias Name based virtual hosts IP based virtual hosts Virtual host examples File descriptor limits Mass virtual hosting Details of host matching Virtual Host Support Name based Virtual Hosts More than one web site per IP address IP based Virtual Hosts An IP address for each web site Virtual Host examples for common setups File Descriptor Limits or Too many log files Dynamically Configured Mass Virtual Hosting In Depth Discussion of Virtual Host Matching Configuration directives VirtualHost NameVirtualHost ServerName ServerAlias ServerPath If you are trying to debug your virtual host configuration you may find

    Original URL path: http://bc.capitalsafety.com/manual/vhosts/ (2016-02-16)
    Open archived version from archive

  • Content Negotiation - Apache HTTP Server
    mime to designate its Charset Content Type Language or Encoding then the result depends on the setting of the MultiViewsMatch directive This directive determines whether handlers filters and other extension types can participate in MultiViews negotiation The Negotiation Methods After Apache has obtained a list of the variants for a given resource either from a type map file or from the filenames in the directory it invokes one of two methods to decide on the best variant to return if any It is not necessary to know any of the details of how negotiation actually takes place in order to use Apache s content negotiation features However the rest of this document explains the methods used for those interested There are two negotiation methods Server driven negotiation with the Apache algorithm is used in the normal case The Apache algorithm is explained in more detail below When this algorithm is used Apache can sometimes fiddle the quality factor of a particular dimension to achieve a better result The ways Apache can fiddle quality factors is explained in more detail below Transparent content negotiation is used when the browser specifically requests this through the mechanism defined in RFC 2295 This negotiation method gives the browser full control over deciding on the best variant the result is therefore dependent on the specific algorithms used by the browser As part of the transparent negotiation process the browser can ask Apache to run the remote variant selection algorithm defined in RFC 2296 Dimensions of Negotiation Dimension Notes Media Type Browser indicates preferences with the Accept header field Each item can have an associated quality factor Variant description can also have a quality factor the qs parameter Language Browser indicates preferences with the Accept Language header field Each item can have a quality factor Variants can be associated with none one or more than one language Encoding Browser indicates preference with the Accept Encoding header field Each item can have a quality factor Charset Browser indicates preference with the Accept Charset header field Each item can have a quality factor Variants can indicate a charset as a parameter of the media type Apache Negotiation Algorithm Apache can use the following algorithm to select the best variant if any to return to the browser This algorithm is not further configurable It operates as follows First for each dimension of the negotiation check the appropriate Accept header field and assign a quality to each variant If the Accept header for any dimension implies that this variant is not acceptable eliminate it If no variants remain go to step 4 Select the best variant by a process of elimination Each of the following tests is applied in order Any variants not selected at each test are eliminated After each test if only one variant remains select it as the best match and proceed to step 3 If more than one variant remains move on to the next test Multiply the quality factor from the Accept header with the quality of source factor for this variants media type and select the variants with the highest value Select the variants with the highest language quality factor Select the variants with the best language match using either the order of languages in the Accept Language header if present or else the order of languages in the LanguagePriority directive if present Select the variants with the highest level media parameter used to give the version of text html media types Select variants with the best charset media parameters as given on the Accept Charset header line Charset ISO 8859 1 is acceptable unless explicitly excluded Variants with a text media type but not explicitly associated with a particular charset are assumed to be in ISO 8859 1 Select those variants which have associated charset media parameters that are not ISO 8859 1 If there are no such variants select all variants instead Select the variants with the best encoding If there are variants with an encoding that is acceptable to the user agent select only these variants Otherwise if there is a mix of encoded and non encoded variants select only the unencoded variants If either all variants are encoded or all variants are not encoded select all variants Select the variants with the smallest content length Select the first variant of those remaining This will be either the first listed in the type map file or when variants are read from the directory the one whose file name comes first when sorted using ASCII code order The algorithm has now selected one best variant so return it as the response The HTTP response header Vary is set to indicate the dimensions of negotiation browsers and caches can use this information when caching the resource End To get here means no variant was selected because none are acceptable to the browser Return a 406 status meaning No acceptable representation with a response body consisting of an HTML document listing the available variants Also set the HTTP Vary header to indicate the dimensions of variance Fiddling with Quality Values Apache sometimes changes the quality values from what would be expected by a strict interpretation of the Apache negotiation algorithm above This is to get a better result from the algorithm for browsers which do not send full or accurate information Some of the most popular browsers send Accept header information which would otherwise result in the selection of the wrong variant in many cases If a browser sends full and correct information these fiddles will not be applied Media Types and Wildcards The Accept request header indicates preferences for media types It can also include wildcard media types such as image or where the matches any string So a request including Accept image would indicate that any type starting image is acceptable as is any other type Some browsers routinely send wildcards in addition to explicit types they can handle For example Accept text html text plain image gif image jpeg The intention

    Original URL path: http://bc.capitalsafety.com/manual/content-negotiation.html (2016-02-16)
    Open archived version from archive



  •