Skip to content

Instantly share code, notes, and snippets.

@shamangeorge
Last active December 22, 2022 07:00
Show Gist options
  • Save shamangeorge/6062991 to your computer and use it in GitHub Desktop.
Save shamangeorge/6062991 to your computer and use it in GitHub Desktop.
apache virtual host with custom directory index configuration
<VirtualHost *:80>
ServerName www.example.com
# For local dev machines
ServerAlias staging.www.example.com
ServerAlias dev.www.example.com
DocumentRoot /var/www/www.example.com
<Directory /var/www/www.example.com>
Options +FollowSymlinks +Multiviews +Indexes
AllowOverride All
## FANCY INDEX Directories ##
IndexOptions +FancyIndexing
IndexOptions +VersionSort
IndexOptions +HTMLTable
IndexOptions +FoldersFirst
IndexOptions +IconsAreLinks
IndexOptions +IgnoreCase
IndexOptions +SuppressDescription
IndexOptions +SuppressHTMLPreamble
IndexOptions +XHTML
IndexOptions +IconWidth=16
IndexOptions +IconHeight=16
IndexOptions +NameWidth=*
IndexOptions +DescriptionWidth=200
IndexOptions +Charset=UTF-8
IndexOrderDefault Descending Name
# /include is an aliased directory
# with the content of the header and footer
# and optionally with the icons as well
# here we use an external CDN to fetch imgs
HeaderName /include/tmp_listing_header.html
ReadmeName /include/footer_listing.html
IndexStyleSheet http://cdn.fruitopology.net/css/main.css
AddIcon http://cdn.fruitopology.net/img/icons/type_application.png .exe .app .EXE .APP
AddIcon http://cdn.fruitopology.net/img/icons/type_binary.png .bin .hqx .uu .BIN .HQX .UU
AddIcon http://cdn.fruitopology.net/img/icons/type_box.png .tar .tgz .tbz .tbz2 bundle .rar .TAR .TGZ .TBZ .TBZ2
AddIcon http://cdn.fruitopology.net/img/icons/type_rar.png .rar .RAR
AddIcon http://cdn.fruitopology.net/img/icons/type_html.png .htm .html .HTM .HTML
AddIcon http://cdn.fruitopology.net/img/icons/type_code.png .htx .htmls .dhtml .phtml .shtml .inc .ssi .c .cc .css .h .rb .js .rb .pl .py .sh .shar .csh .ksh .tcl .as
AddIcon http://cdn.fruitopology.net/img/icons/type_database.png .db .sqlite
AddIcon http://cdn.fruitopology.net/img/icons/type_disc.png .iso .image
AddIcon http://cdn.fruitopology.net/img/icons/type_document.png .ttf
AddIcon http://cdn.fruitopology.net/img/icons/type_excel.png .xlsx .xls .xlm .xlt .xla .xlb .xld .xlk .xll .xlv .xlw
AddIcon http://cdn.fruitopology.net/img/icons/type_flash.png .flv
AddIcon http://cdn.fruitopology.net/img/icons/type_illustrator.png .ai .eps .epsf .epsi
AddIcon http://cdn.fruitopology.net/img/icons/type_pdf.png .pdf
AddIcon http://cdn.fruitopology.net/img/icons/type_php.png .php .phps .php5 .php3 .php4 .phtm
AddIcon http://cdn.fruitopology.net/img/icons/type_photoshop.png .psd
AddIcon http://cdn.fruitopology.net/img/icons/type_monitor.png .ps
AddIcon http://cdn.fruitopology.net/img/icons/type_powerpoint.png .ppt .pptx .ppz .pot .pwz .ppa .pps .pow
AddIcon http://cdn.fruitopology.net/img/icons/type_swf.png .swf
AddIcon http://cdn.fruitopology.net/img/icons/type_text.png .tex .dvi
AddIcon http://cdn.fruitopology.net/img/icons/type_vcf.png .vcf .vcard
AddIcon http://cdn.fruitopology.net/img/icons/type_word.png .doc .docx
AddIcon http://cdn.fruitopology.net/img/icons/type_zip.png .Z .z .tgz .gz .zip
AddIcon http://cdn.fruitopology.net/img/icons/type_globe.png .wrl .wrl.gz .vrm .vrml .iv
AddIcon http://cdn.fruitopology.net/img/icons/type_android.gif .apk .APK
AddIconByType (TXT,http://cdn.fruitopology.net/img/icons/type_text.png) text/*
AddIconByType (IMG,http://cdn.fruitopology.net/img/icons/type_image.png) image/*
AddIconByType (SND,http://cdn.fruitopology.net/img/icons/type_audio.png) audio/*
AddIconByType (VID,http://cdn.fruitopology.net/img/icons/type_video.png) video/*
AddIconByEncoding (CMP,http://cdn.fruitopology.net/img/icons/type_box.png) x-compress x-gzip
AddIcon http://cdn.fruitopology.net/img/icons/back.png ..
AddIcon http://cdn.fruitopology.net/img/icons/information.png README INSTALL
AddIcon http://cdn.fruitopology.net/img/icons/type_folder.png ^^DIRECTORY^^
AddIcon http://cdn.fruitopology.net/img/icons/blank.png ^^BLANKICON^^
DefaultIcon http://cdn.fruitopology.net/img/icons/type_document.png
Order deny,allow
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel debug
CustomLog ${APACHE_LOG_DIR}/www_access.log combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment