Skip to content

Instantly share code, notes, and snippets.

@emilfolino
Created September 5, 2019 07:28
Show Gist options
  • Save emilfolino/69a0dee7d7cd6d460b5cd32328f452bb to your computer and use it in GitHub Desktop.
Save emilfolino/69a0dee7d7cd6d460b5cd32328f452bb to your computer and use it in GitHub Desktop.
httpd-vhosts.conf
# Virtual Hosts
#
# Required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Users/efo/Sites"
<Directory "/Users/efo/Sites">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
</VirtualHost>
Define site dbwebb.se
ServerAdmin [email protected]
<VirtualHost *:80>
ServerName ${site}
ServerAlias local.${site}
ServerAlias do1.${site}
ServerAlias do2.${site}
ServerAlias bth1.${site}
DocumentRoot /Users/efo/htdocs/${site}/htdocs
ServerSignature Off
Include /Users/efo/htdocs/${site}/config/apache-env
Include /Users/efo/htdocs/${site}/config/apache-redirects
Include /Users/efo/htdocs/${site}/config/apache-rewrites
<Directory />
#FallbackResource /index.php
# Rewrite to frontcontroller
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [NC,L]
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
Order allow,deny
Allow from all
Deny from env=spambot
Options +ExecCGI
AddHandler cgi-script .cgi
</Directory>
<FilesMatch "\.(jpe?g|png|gif|js|css|svg|ttf|otf|eot|woff|woff2|ico)">
ExpiresActive On
ExpiresDefault "access plus 1 week"
</FilesMatch>
#LogLevel alert rewrite:trace6
# tail -f error.log | fgrep '[rewrite:'
ErrorLog /Users/efo/htdocs/${site}/error.log
CustomLog /Users/efo/htdocs/${site}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName local.jsramverk.me
DocumentRoot /Users/efo/git/jsramverk.me/output
Options Indexes FollowSymLinks
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule !.*\.html$ %{REQUEST_FILENAME}.html [L]
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment