1. Site example

Created Monday 02 December 2013

1<VirtualHost *:80>
2 ServerAdmin admin@domain.com
3 ServerName domain.com
4 DocumentRoot /var/vhosts/domain.com
5 <Directory />
6 Options FollowSymLinks
7 AllowOverride None
8 </Directory>
9 <Directory /var/vhosts/domain.com>
10 ErrorDocument 404 default
11 Options -Indexes FollowSymLinks MultiViews
12# AllowOverride All
13# Order allow,deny
14# allow from all
15 AuthType Basic
16 AuthName "Password protected"
17 AuthUserFile /var/vhosts/domain.com/.htpasswd
18 require valid-user
19 </Directory>
20
21 <Directory /var/www/domain.com/admin>
22 Options -Indexes FollowSymLinks MultiViews
23 Order deny,allow
24 deny from all
25# allow from 127.0.0.1
26 allow from 10.0.0.138
27 allow from 162.168.169.256
28 allow from 10.0.2.0/24
29 allow from 192.168.1.1
30 allow from 192.168.2.2
31 </Directory>
32
33
34 ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
35 <Directory "/usr/lib/cgi-bin">
36 AllowOverride None
37 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
38 Order allow,deny
39 Allow from all
40 </Directory>
41
42 ErrorLog ${APACHE_LOG_DIR}/error.log
43
44 # Possible values include: debug, info, notice, warn, error, crit,
45 # alert, emerg.
46 LogLevel warn
47
48 CustomLog ${APACHE_LOG_DIR}/access.log combined
49
50 Alias /doc/ "/usr/share/doc/"
51 <Directory "/usr/share/doc/">
52 Options Indexes MultiViews FollowSymLinks
53 AllowOverride None
54 Order deny,allow
55 Deny from all
56 Allow from 127.0.0.0/255.0.0.0 ::1/128
57 </Directory>
58
59</VirtualHost>
60
61#################### SSL #######################
62<VirtualHost 10.0.0.138:443>
63 SSLEngine On
64 ServerAdmin admin@domain.com
65
66 DocumentRoot /var/vhosts/domain.com
67 <Directory />
68 Options FollowSymLinks
69 AllowOverride None
70 </Directory>
71 <Directory /var/vhosts/domain.com>
72 Options -Indexes FollowSymLinks MultiViews
73 AllowOverride None
74 </Directory>
75
76 <Directory /var/vhosts/domain.com/admin>
77 Options -Indexes FollowSymLinks MultiViews
78 Order deny,allow
79 deny from all
80 allow from 10.0.0.1
81 allow from 10.0.0.138
82 allow from 192.168.169.256
83 allow from 10.0.2.0/24
84 allow from 127.0.0.1
85 allow from 127.0.0.12
86 </Directory>
87
88 SSLCertificateFile /etc/ssl/certs/certtest.crt
89 SSLCertificateKeyFile /etc/ssl/private/certtest.key
90# SSLCACertificateFile /etc/apache2/ssl/ca/rapid_ca
91
92 ErrorLog ${APACHE_LOG_DIR}/ssl_error.log
93 LogLevel warn
94 CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
95</VirtualHost>



Backlinks: