Apache Virtual Host Generator
Generate an Apache VirtualHost for PHP through PHP-FPM, a reverse proxy or a static site, with an HTTP to HTTPS redirect and Let's Encrypt certificate paths.
Free · No sign-up · Your inputs stay in your browser
Input
Generate an Apache virtual host
Output
/etc/apache2/sites-available/example.com.conf
930 characters
Enable the modules first: a2enmod proxy_fcgi setenvif rewrite ssl headers http2, then a2ensite example.com and apachectl configtest before systemctl reload apache2. PHP through proxy_fcgi lets Apache run the event MPM instead of prefork, which mod_php requires.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
PHP-FPM instead of mod_php
mod_php embeds PHP in every Apache process and forces the prefork MPM. Handing PHP to PHP-FPM through proxy_fcgi lets Apache run the event MPM, which handles many more idle keep-alive connections with less memory, and lets PHP be restarted and tuned on its own. The mod_proxy_fcgi documentation has the details.
Enabling it
On Debian and Ubuntu, put the file in sites-available, enable the modules and the site with a2enmod and a2ensite, then run apachectl configtest before systemctl reload apache2. A reload keeps serving existing requests while it loads the new configuration.