Apache Config Generator
Generate Apache VirtualHost and .htaccess configs with SSL, reverse proxy, PHP-FPM, mod_deflate, security headers, rewrites, and directory options. 6 presets.
Updated
Apache Config Generator
Generate production-ready Apache VirtualHost and .htaccess configurations with SSL, reverse proxy, PHP handler, mod_deflate, security headers, and rewrites.
Output Format
Preset Templates
VirtualHost
SSL / TLS
Reverse Proxy
PHP Handler
Compression (mod_deflate)
Security Headers
Redirects & Rewrites
Directory Options
httpd.conf Output
# Main VirtualHost
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ServerAdmin admin@example.com
DocumentRoot /var/www/html
# Logging
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# Compression (requires mod_deflate)
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE image/svg+xml
DeflateCompressionLevel 6
</IfModule>
# Directory configuration
<Directory /var/www/html>
AllowOverride All
Options -Indexes +FollowSymLinks
Require all granted
# SPA / history-mode fallback
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /index.html [L]
</IfModule>
</Directory>
# Deny access to hidden files
<FilesMatch "^\.">
Require all denied
</FilesMatch>
</VirtualHost>Frequently Asked Questions
What is the Apache Config Generator?
The Apache Config Generator is a free online tool that generate apache virtualhost and .htaccess configs with ssl, reverse proxy, php-fpm, mod_deflate, security headers, rewrites, and directory options. 6 presets.. It runs entirely in your browser with no installation or sign-up needed.
What output formats?
Two: httpd.conf VirtualHost block for sites-available, and .htaccess for directory-level overrides.
What presets?
Six: Static Site, WordPress, Laravel, Django, Node.js Proxy, SPA.
Is config sent to a server?
No. Everything runs client-side.
Is the Apache Config Generator free to use?
Yes, the Apache Config Generator is 100% free with no registration, no hidden fees, and no usage limits. All processing happens locally in your browser, ensuring complete privacy.
Is my data safe with this tool?
Absolutely. The Apache Config Generator processes everything client-side in your browser. No data is uploaded to or stored on any server. Your content remains private on your device at all times.
Does the Apache Config Generator work on mobile devices?
Yes, the Apache Config Generator is fully responsive and works on smartphones and tablets. You can use it on any device with a modern web browser -- no app download required.
Do I need to create an account to use this tool?
No account or registration is needed. Simply open the Apache Config Generator in your browser and start using it immediately. There are no sign-up walls or usage restrictions.
How do I use the Apache Config Generator?
Simply enter your input in the provided field, adjust any settings to your preference, and the tool will process it instantly. You can then copy the result to your clipboard or download it.
Which browsers are supported?
The Apache Config Generator works in all modern browsers including Chrome, Firefox, Safari, Edge, and Opera. For the best experience, use the latest version of your preferred browser.
What is the difference between a VirtualHost config and a .htaccess file?
A VirtualHost block lives in the main server config (typically in sites-available) and defines a whole site: ServerName, DocumentRoot, logging, the Directory block, and SSL. It loads once at startup, so it's fast and can use any directive Apache supports. A .htaccess file sits inside your web root and applies only to that directory and its subfolders. Apache re-reads it on every request, which is slower, and it can only contain directives your host permits through AllowOverride. You use .htaccess when you don't control the main config, such as on shared hosting; you use VirtualHost when you have root access and want the best performance. This generator emits whichever format you choose, wrapping .htaccess rules in IfModule guards so they degrade safely. Toggle the output format at the top and compare both for your setup.
Why does my Apache config need mod_proxy or mod_headers enabled?
Many directives only work if the matching Apache module is loaded. ProxyPass and ProxyPassReverse require mod_proxy (plus mod_proxy_http or mod_proxy_fcgi for the backend type), the security and HSTS headers need mod_headers, gzip compression needs mod_deflate, and the PHP-FPM handler routes through mod_proxy_fcgi. If a module isn't enabled, Apache either ignores the line or refuses to start with a syntax error. That's why this tool labels each generated block with the module it depends on, for example "requires mod_proxy" or "requires mod_headers" — the output doubles as a checklist. On Debian and Ubuntu you enable a module with a2enmod, then reload Apache. After generating your config here, scan those comments, enable any missing modules, and run apachectl configtest before reloading to catch problems early.
How do I redirect HTTP to HTTPS in Apache?
The cleanest way is a dedicated port 80 VirtualHost whose only job is to send visitors to HTTPS, rather than a rewrite buried inside your main config. When you enable SSL in this generator, it writes exactly that: a separate VirtualHost on port 80 with a permanent redirect to the https:// version of the same host, while the real site lives in the port 443 block. This keeps the redirect simple, cache-friendly, and easy to read. You can also add HSTS, which tells browsers to use HTTPS automatically on future visits; the tool emits a Strict-Transport-Security header with includeSubDomains and preload and a max-age you set. Note that HSTS only takes effect after the first successful HTTPS visit, so test your certificate first. Enable SSL in the panel and the redirect host is generated for you.
Which TLS protocols and SSL settings does the generated config use?
The SSL output is deliberately modern: it enables only TLS 1.2 and TLS 1.3 and explicitly disables SSLv3, TLS 1.0, and TLS 1.1, which are obsolete and flagged by security scanners. It also writes a sane cipher suite and references your certificate and key paths, which you fill in for your own files. Optionally it adds HSTS with a configurable max-age, includeSubDomains, and preload so browsers stick to HTTPS. These defaults aim for a strong rating without breaking modern clients, but TLS 1.3 support depends on your Apache and OpenSSL versions, so very old servers may need a tweak. Because the config never leaves your browser, your certificate paths stay private. Turn on the SSL section, enter your cert and key locations, and copy the hardened block straight into sites-available.
What does the generator do to protect hidden dotfiles and directory listings?
Two common security mistakes are exposing dotfiles like .env, .git, or .htpasswd, and letting Apache auto-generate a browsable listing when no index file exists. This tool guards against both. It can add a rule that denies access to files beginning with a dot, so secrets and version-control folders aren't downloadable over the web. For listings, the Directory options let you control the Options directive — removing Indexes turns off automatic directory browsing — alongside AllowOverride and Require for access control. The Static Site preset, for instance, ships with directory listing disabled and AllowOverride None. These are sensible production defaults, but you should still confirm sensitive paths aren't served and keep secrets outside DocumentRoot entirely. Open the Directory options section, enable the dotfile-deny rule, and adjust Options to match how locked-down you want the site.
Related Tools
Free Website Speed Test
Analyze website page load time, performance metrics, and optimization opportunities. Free, fast, and works entirely in your browser with no sign-up required.
Free Mobile Friendly Test
Check if your site is optimized for mobile devices. Free, fast, and works entirely in your browser with no sign-up required.
Free Meta Tag Extractor
Extract and review all meta tags from any webpage for SEO and social media analysis. Free, fast, and works entirely in your browser with no sign-up required.
Free Website Screenshot Tool
Capture full-page or viewport screenshots of any webpage for design review and testing. Free, fast, and works entirely in your browser with no sign-up required.
About the Apache Config Generator
The Apache Config Generator builds ready-to-paste Apache HTTP Server configuration from a set of toggles and fields, so you don't have to remember the exact directive names and syntax. Pick a starting preset, fill in your domain and paths, switch features on, and the tool writes the matching <VirtualHost> or .htaccess block in real time. It's aimed at developers, sysadmins, and anyone deploying a site to an Apache box who wants a correct, sensibly-ordered config without hand-typing every line.
Everything runs in your browser. The config is generated locally with JavaScript as you edit — nothing you type (domain names, file paths, certificate locations) is uploaded or stored on a server. There's no sign-up and no usage limit, and you can copy the output to your clipboard or download it as a .conf or .htaccess file.
Two output formats: VirtualHost and .htaccess
A single toggle switches between the two places Apache configuration normally lives:
- httpd.conf VirtualHost — a full
<VirtualHost>block forsites-available, the server-level config that definesServerName,DocumentRoot, logging, the<Directory>block, and (when SSL is on) a separate port 80 redirect host. - .htaccess — a directory-level file you drop into your web root when you don't have access to the main server config, such as on shared hosting. It emits the rewrite, compression, header, and directory rules wrapped in
<IfModule>guards.
The output panel shows a live line count and updates instantly, so you can see exactly how each option changes the generated file before you ship it.
Presets for common stacks
Rather than starting from a blank file, you can apply one of six presets that pre-fill realistic defaults for a given stack:
- Static Site — plain HTML/CSS/JS with
AllowOverride Noneand directory listing disabled. - WordPress — PHP-FPM enabled, pretty-permalink rewrites, and
X-Frame-Options: SAMEORIGIN. - Laravel — PHP-FPM with the document root pointed at
public/and front-controller rewrites. - Django — reverse proxy to Gunicorn on
127.0.0.1:8000via mod_proxy. - Node.js Proxy — reverse proxy to an Express/Node app on port 3000.
- SPA — single-page app with an HTML5 history-mode fallback to
index.html.
Each preset is a starting point: every field stays editable, so you can adjust a WordPress config or tighten a proxy target without losing the rest.
What you can configure
Beyond the basics (ServerName, ServerAlias, DocumentRoot, ServerAdmin, log paths, listen port), the generator covers the features most production sites need:
- SSL / TLS — certificate and key paths, protocol selection limited to TLS 1.2 and 1.3 (older protocols are explicitly disabled), a sane cipher suite, and optional HSTS with a configurable
max-age. - Reverse proxy —
ProxyPass/ProxyPassReverseto a backend, with optional forwarding headers (X-Forwarded-Proto,X-Forwarded-Port,X-Real-IP). - PHP-FPM — a
<FilesMatch \.php$>handler routed throughproxy_fcgito a Unix socket such as/run/php/php8.2-fpm.sock. - Compression —
mod_deflatewith selectable MIME types and a compression level. - Security headers — X-Frame-Options, X-Content-Type-Options, Content-Security-Policy, Referrer-Policy, and X-XSS-Protection via
mod_headers. - Redirects and rewrites — HTTP-to-HTTPS, www/non-www canonicalization, and your own custom
RewriteRulepatterns with editable flags. - Directory options —
AllowOverride,Options, andRequire, plus an automatic rule that denies access to hidden dotfiles.
Because the generator names the module each block depends on (for example, "requires mod_proxy" or "requires mod_headers"), the output doubles as a checklist of the Apache modules you'll need to enable. Always run apachectl configtest before reloading to confirm the syntax on your specific Apache version.