Sample Apache Virtual Host Configuration File - vhost.conf
Published: 2024-01-19 | Updated: 2024-05-16Sample default /etc/apache2/sites-available/default.conf
file
Note: This file is for non-SSL requests. Certbot sets up the SSL version when it runs. It is important to have this file operating correctly before running Certbot to set up certificates b/c Certbot copies this file as template for the SSL version.
<VirtualHost *:80>
ServerAdmin mark.ewers@gmail.com
ServerName myDomain.me
ServerAlias www.myDomain.me
DocumentRoot /var/www/myDomain/public
# This directive will send all requests to index.php
<Directory /var/www/myDomain/public>
# Disallow .htaccess override
AllowOverride All
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ErrorDocument 404 /404.html
# Overrides what's in /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.htm
</IfModule>
</VirtualHost>