Apache/AutoIndex: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
 
Line 1: Line 1:
==Alias==
==Alias==
<code>nano /etc/apache2/mods-enabled/alias.conf</code>
<source lang="ini" highlight="14,16-20" line>
<source lang="ini" highlight="14,16-20" line>
<IfModule alias_module>
<IfModule alias_module>

Latest revision as of 23:56, 30 August 2019

Alias

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

<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>

</IfModule>

Auto Index

nano /etc/apache2/mods-enabled/autoindex.conf

<IfModule mod_autoindex.c>
        # Directives controlling the display of server-generated directory listings.

        #
        # IndexOptions: Controls the appearance of server-generated directory
        # listings.
        # Remove/replace the "Charset=UTF-8" if you don't use UTF-8 for your filenames.
        IndexOptions FancyIndexing VersionSort HTMLTable NameWidth=* DescriptionWidth=* Charset=UTF-8 SuppressDescription SuppressRules FoldersFirst XHTML
        IndexStyleSheet /icons/style.css

        #
        # AddIcon* directives tell the server which icon to show for different
        # files or filename extensions.  These are only displayed for
        # FancyIndexed directories.
        AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip x-bzip2

        AddIconByType (TXT,/icons/text.gif) text/*
        AddIconByType (IMG,/icons/image.gif) image/*
        AddIconByType (SND,/icons/sound.gif) audio/*
        AddIconByType (VID,/icons/movie.gif) video/*
        AddIconByType (HTML,/icons/html.gif) text/html

        AddIcon /icons/binary.gif .bin .exe .so .dll
        AddIcon /icons/binhex.gif .hqx
        AddIcon /icons/tar.gif .tar
        AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
        AddIcon /icons/compressed.gif .Z .z .7z .tgz .gz .zip
        AddIcon /icons/a.gif .ps .ai .eps .doc .psd .docx
        AddIcon /icons/html.gif .html .shtml .htm .css .xml .xhtml .chm
        AddIcon /icons/pdf.gif .pdf
        AddIcon /icons/log.gif .log
        AddIcon /icons/c.gif .c .cpp .c++ .h
        AddIcon /icons/pl.gif .pl
        AddIcon /icons/py.gif .py .pyc
        AddIcon /icons/spy.gif .spy
        AddIcon /icons/php.gif .php
        AddIcon /icons/cgi.gif .cgi
        AddIcon /icons/f.gif .for
        AddIcon /icons/dvi.gif .dvi
        AddIcon /icons/uuencoded.gif .uu
        AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl .cmd .bat
        AddIcon /icons/jar.gif .jar
        AddIcon /icons/pom.gif .pom
        AddIcon /icons/md5.gif .md5
        AddIcon /icons/sha1.gif .sha1
        AddIcon /icons/tex.gif .tex
        # It's a suffix rule, so simply matching "core" matches "score" as well !
        AddIcon /icons/bomb.gif /core
        AddIcon (SND,/icons/sound.gif) .ogg
        AddIcon (VID,/icons/movie.gif) .ogm

        AddIcon /icons/back.gif ..
        AddIcon /icons/hreadme.gif readme README
        AddIcon /icons/folder.gif ^^DIRECTORY^^
        AddIcon /icons/folder.open.gif ^^BLANKICON^^

        # Default icons for OpenDocument format
        AddIcon /icons/odf6odt-20x22.png .odt
        AddIcon /icons/odf6ods-20x22.png .ods
        AddIcon /icons/odf6odp-20x22.png .odp
        AddIcon /icons/odf6odg-20x22.png .odg
        AddIcon /icons/odf6odc-20x22.png .odc
        AddIcon /icons/odf6odf-20x22.png .odf
        AddIcon /icons/odf6odb-20x22.png .odb
        AddIcon /icons/odf6odi-20x22.png .odi
        AddIcon /icons/odf6odm-20x22.png .odm

        AddIcon /icons/odf6ott-20x22.png .ott
        AddIcon /icons/odf6ots-20x22.png .ots
        AddIcon /icons/odf6otp-20x22.png .otp
        AddIcon /icons/odf6otg-20x22.png .otg
        AddIcon /icons/odf6otc-20x22.png .otc
        AddIcon /icons/odf6otf-20x22.png .otf
        AddIcon /icons/odf6oti-20x22.png .oti
        AddIcon /icons/odf6oth-20x22.png .oth

        #
        # DefaultIcon is which icon to show for files which do not have an icon
        # explicitly set.
        DefaultIcon /icons/unknown.gif

        #
        # AddDescription allows you to place a short description after a file in
        # server-generated indexes.  These are only displayed for FancyIndexed
        # directories.
        # Format: AddDescription "description" filename
        AddDescription "Readme File" readme
        AddDescription "Core File" core
        AddDescription "GZIP compressed document" .gz
        AddDescription "GZIP compressed tar archive" .tgz
        AddDescription "Tar archive" .tar
        AddDescription "Zip Archive" .zip
        AddDescription "<a href=\"http://www.apple.com/quicktime/\" title=\"Quicktime\">QuickTime</a> Movie" .mov
        AddDescription "<a href=\"http://www.real.com/\" title=\"RealNetworks\">RealNetworks</a> Movie" .ra .ram
        AddDescription "Plain-text Document" .txt
        AddDescription "Web document" .HTML .xhtml
        AddDescription "Compile HTML" .chm .CHM
        AddDescription "Document" .ps .ai .eps .pdf .psd .doc .docx
        AddDescription "Binary File" .bin .exe .so .dll .pyc .class
        AddDescription "Log File" .log
        AddDescription "MD5 Digest" .md5 .jar.md5 .pom.md5
        AddDescription "SHA1 Digest" .sha1 .jar.sha1 pom.sha1
        AddDescription "Java Archive" .jar
        AddDescription "Maven pom" .pom
        AddDescription "Script" .conf .sh .shar .csh .ksh .tcl .cmd .bat
        AddDescription "PHP Script" .php
        AddDescription "Perl Script" .pl
        AddDescription "Pyhon Script" .py .spy
        AddDescription "C Script" .cpp .c++
        AddDescription "3D World" .wrl .wrl.gz .vrml .vrm .iv
        AddDescription "Icon" .ico
        AddDescription "<acronym title=\"Motion Picture Experts Group Audio Layer 3\">MP3</acronym> Audio File" .mp3
        AddDescription "<acronym title=\"HyperText Markup Language\">HTML</acronym> Page" .html .htm .shtml
        AddDescription "<acronym title=\"Portable Network Graphics\">PNG</acronym> Image" .png
        AddDescription "<acronym title=\"Graphics Interchange Format\">GIF</acronym> Image" .gif
        AddDescription "<acronym title=\"Joint Photographic Experts Group\">JPEG</acronym> Image" .jpg .jpeg
        AddDescription "<acronym title=\"Bitmap\">BMP</acronym> Image" .bmp
        AddDescription "<acronym title=\"Extensive Markup Language\">XML</acronym> File" .xml
        AddDescription "<acronym title=\"Common Gateway Interface\">CGI</acronym> parsed script" .cgi
        AddDescription "<acronym title=\"Cascading Style Sheet\">CSS</acronym> File" .css

        #
        # ReadmeName is the name of the README file the server will look for by
        # default, and append to directory listings.
        #
        # HeaderName is the name of a file which should be prepended to
        # directory indexes
        ReadmeName /icons/README.html
        HeaderName HEADER.html

        #
        # IndexIgnore is a set of filenames which directory indexing should ignore
        # and not include in the listing.  Shell-style wildcarding is permitted.
        IndexIgnore .??* *~ *# RCS CVS *,v *,t HEADER.html README.html favicon.ico README cgi-bin

</IfModule>