Skip to content

Instantly share code, notes, and snippets.

@imanilchaudhari
Created February 26, 2019 09:13
Show Gist options
  • Save imanilchaudhari/230e0fc91826006fdd63ff6b2bd02502 to your computer and use it in GitHub Desktop.
Save imanilchaudhari/230e0fc91826006fdd63ff6b2bd02502 to your computer and use it in GitHub Desktop.
Apache Virtual hosts examples http, https both
# example.com.conf:
<VirtualHost *:80>
ServerName example.com
ServerAdmin admin@example.com
DocumentRoot /var/www/example.com/html
<Directory /var/www/example.com/html>
Options FollowSymLinks
AllowOverride None
Require all granted
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
</Directory>
ErrorLog ${APACHE_LOG_DIR}/example.com.frontend.error.log
CustomLog ${APACHE_LOG_DIR}/example.com.frontend.access.log combined
</VirtualHost>
# example.com-le-ssl.conf
<VirtualHost *:443>
ServerName example.com
ServerAdmin admin@example.com
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
DocumentRoot /var/www/example.com/html
<Directory /var/www/example.com/html>
Options FollowSymLinks
AllowOverride None
Require all granted
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
</Directory>
ErrorLog ${APACHE_LOG_DIR}/example.com.frontend.error.log
CustomLog ${APACHE_LOG_DIR}/example.com.frontend.access.log combined
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment