CSS Customization
Style your directory listing with custom CSS to match your brand
Apaxy is a customizable theme built to enhance the experience of browsing web directories. It uses Apache’s mod_autoindex module combined with CSS styling to transform the default, plain directory listing into a beautiful, user-friendly file browser.
Apaxy is perfect for:
CSS Customization
Style your directory listing with custom CSS to match your brand
JavaScript Support
Add interactivity and dynamic features with JavaScript
Custom Icons
Over 200 file type icons included with support for custom icons
Gallery Mode
Built-in lightgallery.js integration for image browsing
Deploying Apaxy on Klutch.sh provides several advantages:
Before deploying Apaxy on Klutch.sh, ensure you have:
Create a new directory for your Apaxy project with the following structure:
apaxy-server/├── Dockerfile├── apaxy/│ ├── .htaccess│ ├── header.html│ ├── footer.html│ └── theme/│ ├── style.css│ ├── apaxy.js│ └── icons/│ └── (icon files)├── share/│ └── (your files to share)└── conf/ └── httpd-custom.confKlutch.sh automatically detects Dockerfiles in your repository’s root directory. Create a Dockerfile that sets up Apache with Apaxy:
# Build stage: Configure ApaxyFROM bash AS builder
WORKDIR /app
# Clone Apaxy repositoryRUN apk add --no-cache git && \ git clone https://github.com/oupala/apaxy.git /app/apaxy-src
# Configure Apaxy for root pathWORKDIR /app/apaxy-srcRUN bash apaxy-configure.sh -w ""
# Production stage: Apache with ApaxyFROM httpd:2.4-alpine
# Set labelsLABEL name="apaxy-server" \ description="Apaxy directory listing theme on Apache" \ maintainer="Your Name"
# Remove default index.htmlRUN rm -f /usr/local/apache2/htdocs/index.html
# Enable .htaccess overrides for mod_autoindexRUN sed -i '/<Directory "\/usr\/local\/apache2\/htdocs">/,/<\/Directory>/ s/AllowOverride None/AllowOverride Options Indexes FileInfo/' /usr/local/apache2/conf/httpd.conf
# Configure Apache to listen on port 8080RUN sed -i 's/Listen 80/Listen 8080/g' /usr/local/apache2/conf/httpd.conf
# Enable required Apache modulesRUN sed -i 's/#LoadModule rewrite_module/LoadModule rewrite_module/' /usr/local/apache2/conf/httpd.conf && \ sed -i 's/#LoadModule expires_module/LoadModule expires_module/' /usr/local/apache2/conf/httpd.conf && \ sed -i 's/#LoadModule deflate_module/LoadModule deflate_module/' /usr/local/apache2/conf/httpd.conf
# Copy Apaxy files from builderCOPY --from=builder /app/apaxy-src/apaxy/ /usr/local/apache2/htdocs/
# Copy custom configuration if presentCOPY conf/ /usr/local/apache2/conf/extra/
# Include custom configurationRUN echo "Include conf/extra/httpd-custom.conf" >> /usr/local/apache2/conf/httpd.conf || true
# Create share directory for user filesRUN mkdir -p /usr/local/apache2/htdocs/share
# Set proper permissionsRUN chown -R www-data:www-data /usr/local/apache2/htdocs/ || \ chown -R daemon:daemon /usr/local/apache2/htdocs/
EXPOSE 8080
CMD ["httpd-foreground"]Create a custom Apache configuration file at conf/httpd-custom.conf:
# Custom Apache configuration for Apaxy
# Enable compression<IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css AddOutputFilterByType DEFLATE application/javascript application/json</IfModule>
# Enable caching for static assets<IfModule mod_expires.c> ExpiresActive On ExpiresByType image/png "access plus 1 month" ExpiresByType image/gif "access plus 1 month" ExpiresByType image/svg+xml "access plus 1 month" ExpiresByType text/css "access plus 1 week" ExpiresByType application/javascript "access plus 1 week"</IfModule>
# Security headers<IfModule mod_headers.c> Header always set X-Content-Type-Options "nosniff" Header always set X-Frame-Options "SAMEORIGIN" Header always set X-XSS-Protection "1; mode=block"</IfModule>
# Directory listing configuration<Directory "/usr/local/apache2/htdocs"> Options +Indexes +FollowSymLinks AllowOverride Options Indexes FileInfo Require all granted
# Custom index options IndexOptions FancyIndexing HTMLTable SuppressRules IndexOptions IconsAreLinks ScanHTMLTitles NameWidth=* IndexOptions DescriptionWidth=*</Directory>
# Deny access to hidden files<FilesMatch "^\."> Require all denied</FilesMatch>
# Allow .htaccess<Files ".htaccess"> Require all denied</Files>
# Server status (optional, for monitoring)<Location "/server-status"> SetHandler server-status Require local</Location>Create a custom header.html file to add branding:
<!DOCTYPE html><html lang="en"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>File Browser</title> <link rel="stylesheet" href="/theme/style.css"></head><body> <div id="wrapper"> <header> <h1>📁 File Browser</h1> <p>Welcome to our file sharing server. Browse and download files below.</p> </header> <main>Create a custom footer.html file:
</main> <footer> <p>Powered by <a href="https://oupala.github.io/apaxy/" target="_blank">Apaxy</a> • Hosted on <a href="https://klutch.sh" target="_blank">Klutch.sh</a></p> </footer> </div> <script src="/theme/apaxy.js"></script></body></html>Create or modify theme/style.css for custom styling:
/* Custom Apaxy Theme */:root { --primary-color: #2563eb; --background-color: #f8fafc; --text-color: #1e293b; --border-color: #e2e8f0; --hover-color: #f1f5f9;}
* { box-sizing: border-box;}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background-color: var(--background-color); color: var(--text-color); margin: 0; padding: 0; line-height: 1.6;}
#wrapper { max-width: 1200px; margin: 0 auto; padding: 20px;}
header { text-align: center; padding: 40px 20px; background: linear-gradient(135deg, var(--primary-color), #1d4ed8); color: white; border-radius: 12px; margin-bottom: 30px;}
header h1 { margin: 0 0 10px; font-size: 2.5rem;}
header p { margin: 0; opacity: 0.9;}
/* Directory listing table */table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);}
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border-color);}
th { background: var(--primary-color); color: white; font-weight: 600;}
tr:hover { background: var(--hover-color);}
a { color: var(--primary-color); text-decoration: none;}
a:hover { text-decoration: underline;}
/* Icons */img[alt="[ICO]"],img[alt="[PARENTDIR]"],img[alt="[DIR]"] { width: 24px; height: 24px; vertical-align: middle; margin-right: 8px;}
footer { text-align: center; padding: 30px; color: #64748b; font-size: 0.875rem;}
footer a { color: var(--primary-color);}
/* Responsive design */@media (max-width: 768px) { header h1 { font-size: 1.75rem; }
th, td { padding: 8px 12px; }
/* Hide description on mobile */ td:nth-child(4), th:nth-child(4) { display: none; }}If you prefer a simpler setup using the official Apaxy repository directly:
# Simple Apaxy DockerfileFROM httpd:2.4-alpine
# Install git and bashRUN apk add --no-cache git bash
# Clone ApaxyRUN git clone https://github.com/oupala/apaxy.git /tmp/apaxy
# Configure ApaxyWORKDIR /tmp/apaxyRUN bash apaxy-configure.sh -w ""
# Copy configured Apaxy to Apache htdocsRUN cp -r /tmp/apaxy/apaxy/* /usr/local/apache2/htdocs/
# Remove default index.htmlRUN rm -f /usr/local/apache2/htdocs/index.html
# Enable .htaccess overridesRUN sed -i '/<Directory "\/usr\/local\/apache2\/htdocs">/,/<\/Directory>/ s/AllowOverride None/AllowOverride Options Indexes FileInfo/' /usr/local/apache2/conf/httpd.conf
# Configure port 8080RUN sed -i 's/Listen 80/Listen 8080/g' /usr/local/apache2/conf/httpd.conf
# Create share directoryRUN mkdir -p /usr/local/apache2/htdocs/share
# Clean upRUN rm -rf /tmp/apaxy && apk del git
EXPOSE 8080
CMD ["httpd-foreground"]Test your Apaxy setup locally before deploying to Klutch.sh:
Create a docker-compose.yml for local development:
version: '3.8'
services: apaxy: build: context: . dockerfile: Dockerfile ports: - '8080:8080' volumes: - ./share:/usr/local/apache2/htdocs/share restart: unless-stopped# Build the Docker imagedocker build -t apaxy-server .
# Run the containerdocker run -d -p 8080:8080 -v $(pwd)/share:/usr/local/apache2/htdocs/share apaxy-server
# Test the setupcurl http://localhost:8080/Add some test files to the share directory:
# Create sample filesmkdir -p share/documents share/images share/downloads
# Add sample filesecho "Hello World" > share/documents/readme.txtecho "# Sample Markdown" > share/documents/sample.mdtouch share/downloads/app-v1.0.0.zipVisit http://localhost:8080/share/ to see your themed directory listing.
Push your code to GitHub
Initialize a Git repository and push to GitHub:
cd apaxy-servergit initgit add .git commit -m "Initial Apaxy setup"git remote add origin https://github.com/yourusername/apaxy-server.gitgit push -u origin mainCreate a new project on Klutch.sh
Navigate to klutch.sh/app and create a new project. Give your project a descriptive name like “apaxy-server” or “file-browser”.
Connect your GitHub repository
Select GitHub as your git source and authorize Klutch.sh to access your repositories. Select the repository containing your Apaxy project.
Configure the deployment
Klutch.sh will automatically detect your Dockerfile. Configure the following settings:
Add a persistent volume
To persist your shared files across deployments, add a persistent volume:
/usr/local/apache2/htdocs/shareThis ensures your uploaded files remain available even after redeployments.
Deploy your application
Click the deploy button to start the build process. Klutch.sh will:
Access your Apaxy instance
Once deployed, your Apaxy file browser will be available at:
https://your-app-name.klutch.shYour shared files will be accessible at:
https://your-app-name.klutch.sh/share/Apaxy itself doesn’t require environment variables, but you can configure Apache behavior:
| Variable | Description | Default |
|---|---|---|
APACHE_LOG_DIR | Directory for Apache logs | /usr/local/apache2/logs |
APACHE_RUN_USER | User Apache runs as | daemon |
APACHE_RUN_GROUP | Group Apache runs as | daemon |
Apaxy includes built-in support for lightgallery.js for image browsing. To enable it:
# Add after copying Apaxy filesWORKDIR /usr/local/apache2/htdocs
# Enable gallery modeRUN if [ -f header-lightgallery.html ]; then \ mv header.html header-original.html && \ mv header-lightgallery.html header.html && \ mv footer.html footer-original.html && \ mv footer-lightgallery.html footer.html; \ fiWith gallery mode enabled, clicking on images in the directory listing will open them in a lightbox viewer with:
Apaxy supports custom icons for different file types. To add icons for new file types:
Place your icon in the theme/icons/ directory:
theme/icons/├── custom-type.png└── your-extension.pngAdd icon mappings to your .htaccess:
# Custom file type iconsAddIcon /theme/icons/custom-type.png .customAddIconByType (custom,/theme/icons/custom-type.png) application/x-custom
# Programming languagesAddIcon /theme/icons/typescript.png .ts .tsxAddIcon /theme/icons/rust.png .rsAddIcon /theme/icons/go.png .goTo add basic authentication to your file browser:
Add to conf/httpd-custom.conf:
# Enable auth modulesLoadModule auth_basic_module modules/mod_auth_basic.soLoadModule authn_file_module modules/mod_authn_file.so
<Directory "/usr/local/apache2/htdocs/share/private"> AuthType Basic AuthName "Private Files" AuthUserFile /usr/local/apache2/conf/.htpasswd Require valid-user</Directory># Create password file (replace 'admin' and 'password' with secure values)RUN htpasswd -bc /usr/local/apache2/conf/.htpasswd admin passwordApache logs are stored in /usr/local/apache2/logs/. To persist logs, add a volume:
/usr/local/apache2/logsAdd to your Apache configuration:
# Custom log formatLogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedCustomLog /usr/local/apache2/logs/access.log combinedErrorLog /usr/local/apache2/logs/error.logLogLevel warnTo use a custom domain with your Apaxy deployment:
Navigate to your project settings in the Klutch.sh dashboard
Add your custom domain (e.g., files.yourdomain.com)
Configure DNS by adding a CNAME record pointing to your Klutch.sh app URL
Wait for SSL provisioning - Klutch.sh automatically provisions SSL certificates
Problem: Getting a 403 Forbidden error when accessing directories.
Solution: Ensure .htaccess overrides are enabled:
<Directory "/usr/local/apache2/htdocs"> AllowOverride Options Indexes FileInfo Options +Indexes Require all granted</Directory>Problem: File type icons are not displaying.
Solution: Check the icon paths in .htaccess:
# Paths should be relative to web rootAddIcon /theme/icons/pdf.png .pdfEnsure icons exist in the correct location.
Problem: Custom CSS styles are not being applied.
Solution: Clear browser cache and verify the stylesheet path in header.html:
<link rel="stylesheet" href="/theme/style.css">Problem: Cannot write to share directory.
Solution: Ensure proper permissions in the Dockerfile:
RUN chown -R daemon:daemon /usr/local/apache2/htdocs/share && \ chmod -R 755 /usr/local/apache2/htdocs/shareAdd to your Apache configuration:
<IfModule mod_deflate.c> SetOutputFilter DEFLATE AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css AddOutputFilterByType DEFLATE application/javascript application/json AddOutputFilterByType DEFLATE image/svg+xml
# Exclude already compressed files SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|zip|gz|bz2|rar)$ no-gzip</IfModule><IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 1 week"
# Images ExpiresByType image/png "access plus 1 month" ExpiresByType image/gif "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType image/svg+xml "access plus 1 month"
# CSS and JavaScript ExpiresByType text/css "access plus 1 week" ExpiresByType application/javascript "access plus 1 week"
# HTML ExpiresByType text/html "access plus 1 hour"</IfModule>Here’s a complete file structure for your Apaxy deployment:
apaxy-server/├── Dockerfile├── conf/│ └── httpd-custom.conf├── theme/│ ├── header.html│ ├── footer.html│ ├── style.css│ ├── apaxy.js│ └── icons/│ ├── back.png│ ├── folder.png│ ├── file.png│ └── (more icons...)├── share/│ ├── documents/│ ├── images/│ └── downloads/├── .gitignore└── README.md# Ignore uploaded files (they should be in persistent storage)share/*!share/.gitkeep
# OS files.DS_StoreThumbs.db
# IDE.vscode/.idea/You’ve successfully deployed Apaxy on Klutch.sh! Your styled directory listing provides:
Apaxy transforms Apache’s basic directory listing into a polished, user-friendly file browser that’s perfect for sharing files, hosting downloads, or organizing media libraries.