Apache/Multilang Errordoc: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 72: Line 72:
<code> nano /usr/share/apache2/error/include/top.html</code>
<code> nano /usr/share/apache2/error/include/top.html</code>


<source lang="html">
<source lang="html" highlight="10,11" line>
<!--#if expr="-z v('CONTENT_LANGUAGE')"
<!--#if expr="-z v('CONTENT_LANGUAGE')"
--><!--#set var="CONTENT_LANGUAGE" value="en"
--><!--#set var="CONTENT_LANGUAGE" value="en"

Revision as of 00:16, 31 August 2019

Install

apachectl -M
apache2ctl -M

a2enmod alias
a2enmod include
a2enmod authz_host
a2enmod substitute
a2enmod negotiation

Errordoc

nano /etc/apache2/mods-enabled/alias.conff

<IfModule alias_module>
        # Aliases: Add here as many aliases as you need (with no limit). The format is
        # Alias fakename realname
        #
        # Note that if you include a trailing / on fakename then the server will
        # require it to be present in the URL.  So "/icons" isn't aliased in this
        # example, only "/icons/".  If the fakename is slash-terminated, then the
        # realname must also be slash terminated, and if the fakename omits the
        # trailing slash, the realname must also omit it.
        #
        # We include the /icons/ alias for FancyIndexed directory listings.  If
        # you do not use FancyIndexing, you may comment this out.

        Alias /icons/ "/usr/share/apache2/icons/"

        <Directory "/usr/share/apache2/icons">
                Options FollowSymlinks
                AllowOverride None
                Require all granted
        </Directory>


        Alias /error/ "/usr/share/apache2/error/"

        <Directory "/usr/share/apache2/error">
                AllowOverride None
                Options IncludesNoExec
                AddOutputFilter Includes html
                AddHandler type-map var
                Require all granted
                LanguagePriority en cs de es fr it ja ko nl pl pt-br ro sv tr
                ForceLanguagePriority Prefer Fallback
        </Directory>

</IfModule>

ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
ErrorDocument 410 /error/HTTP_GONE.html.var
ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

Top

nano /usr/share/apache2/error/include/top.html

<!--#if expr="-z v('CONTENT_LANGUAGE')"
--><!--#set var="CONTENT_LANGUAGE" value="en"
--><!--#endif
--><?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<!--#echo var="CONTENT_LANGUAGE" -->" xml:lang="<!--#echo var="CONTENT_LANGUAGE" -->">
<head>
<title><!--#echo encoding="none" var="TITLE" --></title>
<link rel="icon" type="image/x-icon" href="/icons/favicon.ico">
<link rel="stylesheet" href="/icons/style.css" type="text/css" />
<link rev="made" href="mailto:<!--#echo encoding="url" var="SERVER_ADMIN" -->" />
</head>

<body>
<h1><!--#echo encoding="none" var="TITLE" --></h1>
<p>