Skip to content

Instantly share code, notes, and snippets.

@Cezarion
Created October 23, 2018 18:23
Show Gist options
  • Save Cezarion/90efebdda8b140efd621d4cc28893333 to your computer and use it in GitHub Desktop.
Save Cezarion/90efebdda8b140efd621d4cc28893333 to your computer and use it in GitHub Desktop.
Wildcard Vhost
<VirtualHost *:80>
UseCanonicalName Off
ServerName root.localhost
ServerAlias *.localhost
RewriteEngine On
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}
SetEnv APP_ENV dev
</VirtualHost>
<VirtualHost *:443>
UseCanonicalName Off
ServerName root.localhost
ServerAlias *.localhost www.*.localhost *.*.localhost
<If "%{HTTP_HOST} =~ /www/">
Define webdir htdocs
</If>
<IfDefine !webdir>
Define webdir %1
</IfDefine>
VirtualDocumentRoot "/Users/whoami/www/%2/${webdir}"
VirtualScriptAlias "/Users/whoami/www/%2/${webdir}"
ErrorLog "/usr/local/var/log/apache2/www-https.localhost-error_log"
CustomLog "/usr/local/var/log/apache2/www-https.localhost-access_log" common
ServerAdmin whoami@entreprise.com
LogLevel debug
SSLEngine on
SSLCertificateFile "/usr/local/etc/httpd/code.crt"
SSLCertificateKeyFile "/usr/local/etc/httpd/code.key"
<Directory "/Users/whoami/www/">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
SetEnv APP_ENV dev
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment