This is a snippet of my apache2.conf on my remote server with some personal remarks.
Code:
# Computername and port so the computer can identify itself. The system Apache
# runs on has no assigned ip addresses - they are provided. If working with
# several DNS (provider) entries masked on one ip address the <ServerName>
# directive must be taken care of in the <VirtualHost> directives for each of
# the DNS entries or it won't work. You can't have it defined here and in
# the <VirtualHost> directives.
#ServerName example.com:80
ServerAdmin info@your_server.com
ServerSignature Email
... snip
# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf
This is the vhost to the apache2.conf above:
Code:
# --- Vhosts configuration -----------------------------------------------------#
#
# --- mod_autoindex.so standard host --- #
#
# If no matching name-based virtual host is found, then the first listed one
# is used. (including subdomain resolution)
# --- Default auto indexed --- #
<VirtualHost *:80>
DocumentRoot /srv/http/somewhere/
<Directory "/srv/http/somewhere">
blablabla...
# In case you want to have a directory with authenticatio:
# Authentication is setup on directory basis
<Directory "/srv/http/somewhere/AUTHENTICATED">
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>
# Doesn't hide the folder but its content
<Directory "/srv/http/somewhere/css">
Options -Indexes -FollowSymlinks
</Directory>
</VirtualHost>
# --- Main site --- #
<VirtualHost *:80>
Servername somewhere.com:80
DocumentRoot /srv/http/somewhere_else/
<Directory "/srv/http/somewhere_else">
AllowOverride All
Options +Indexes +FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
# --- Subdomain --- #
<VirtualHost *:80>
ServerName map.somewhere.com:80
DocumentRoot /srv/http/you-name-it/
<Directory "/srv/http/map">
AllowOverride All
Options +Indexes +FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
# --- Error pages --- #
# Using a 'hack' so we don't need to set up a directory 'error' under each
# site's document root in a vhost environment by creating a common global one.
Alias /error /srv/http/error
<Directory /srv/http/error/>
AllowOverride None
Options None
Require all granted
</Directory>
The only absolute knowledge attainable by man is that life is meaningless. (Tolstoi)