non_ssl.template.erb 2.93 KB
Newer Older
1
2
3
4
####
##
#
#  This file is automatically generated from the template located at
5
#  /etc/sympl/apache.d/non_ssl.template.erb.
6
#
7
8
#  Feel free to make changes to this file.  However, If changes are made,
#  then this file will NOT be updated automatically when the template changes.
9
10
11
12
#
##
###

Paul Cammish's avatar
Paul Cammish committed
13
14
# Vim Defaults: //vim: ts=2:tw=78: et:

15
16
<VirtualHost <%= ips.collect{|ip| ip+":80"}.join(" ") %>>

Paul Cammish's avatar
Paul Cammish committed
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  #
  # Put our server name
  #
  ServerName  <%= domain %>

  #
  # This is the testing alias.
  #
  ServerAlias <%= domain %>.testing.<%= hostname() %>

  #
  # And server alias in place
  #
  <%= server_aliases %>

  #
  # This is the directory people are redirected to if their site is
  # empty.
  #
  Alias /__sympl/ "/usr/share/sympl/static/"

  <Directory "/usr/share/sympl/static/">
    DirectoryIndex index.html
    AllowOverride none
    Require all granted
  </Directory>

  #
  # And this makes that redirection happen.
  #
  <LocationMatch "^/+$">
    Options -Indexes
    ErrorDocument 403 /__sympl/index.html
  </LocationMatch>

  #
  #  Allow users to override settings via .htaccess
  #    and enables PHP in htdocs/.
  #
  <Directory <%= htdocs_directory %>/ >
    AllowOverride all
    Require all granted
  </Directory>
60

61
% if php_security_disabled?
Paul Cammish's avatar
Paul Cammish committed
62
63
64
65
66
67
  #
  # Set unique tmp/ and sessions/ directories
  #
  php_admin_value upload_tmp_dir <%=domain_directory%>/php_tmp/
  php_admin_value session.save_path <%=domain_directory%>/php_sessions/

68
% else
Paul Cammish's avatar
Paul Cammish committed
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
  #
  # Restricts PHP from leaving the public directory.
  # Also sets unique tmp and sessions directories.
  #

  php_admin_value open_basedir <%=domain_directory%>/public/:<%=domain_directory%>/php_tmp/:<%=domain_directory%>/php_sessions/
  php_admin_value upload_tmp_dir <%=domain_directory%>/php_tmp/
  php_admin_value session.save_path <%=domain_directory%>/php_sessions/

  #
  # Prevent executing anything from a WordPress uploads directory,
  # And block access to any PHP files in that directory.
  #
  <LocationMatch "wp-content/uploads/">
    php_admin_flag engine off
  </LocationMatch>

  <LocationMatch "wp-content/uploads/.*\.php">
    deny from all
  </LocationMatch>
89

Paul Cammish's avatar
Paul Cammish committed
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
% end
  #
  # The document root
  #
  DocumentRoot <%= htdocs_directory %>/

  <IfModule cgi_module>
    #
    # General CGI Handling
    #
    ScriptAlias /cgi-bin/ <%= cgibin_directory %>/

    <Location /cgi-bin>
      Options +ExecCGI
    </Location>
  </IfModule>

  #
  # Disable indexes by default on the top-level.
  #
  <LocationMatch "^/+$">
    Options -Indexes
  </LocationMatch>

  #
  # Disable any restrictions or rewrites to /.well-known/acme-challenge
  # This ensures Let's Encrypt can validate domain ownership.
  #
  <Directory <%= htdocs_directory %>/.well-known/acme-challenge/ >
    Require all granted
    <IfModule rewrite_module>
      RewriteEngine off
    </IfModule>
  </Directory>

  #
  # Write logs
  #
  ErrorLog   "<%= domain.log_dir %>/error.log"
  CustomLog  "<%= domain.log_dir %>/access.log" combined
130
131
</VirtualHost>