| Filip Pytloun | 410abc4 | 2015-10-06 16:28:31 +0200 | [diff] [blame] | 1 | ====== | 
|  | 2 | Apache | 
|  | 3 | ====== | 
|  | 4 |  | 
|  | 5 | Install and configure Apache webserver | 
|  | 6 |  | 
|  | 7 | Available states | 
|  | 8 | ================ | 
|  | 9 |  | 
|  | 10 | .. contents:: | 
|  | 11 | :local: | 
|  | 12 |  | 
|  | 13 | ``apache.server`` | 
|  | 14 | -------------------- | 
|  | 15 |  | 
|  | 16 | Setup apache server | 
|  | 17 |  | 
|  | 18 | Available metadata | 
|  | 19 | ================== | 
|  | 20 |  | 
|  | 21 | .. contents:: | 
|  | 22 | :local: | 
|  | 23 |  | 
|  | 24 | ``metadata.apache.server.single`` | 
|  | 25 | -------------------------- | 
|  | 26 |  | 
|  | 27 | Setup basic server | 
|  | 28 |  | 
|  | 29 | Configuration parameters | 
|  | 30 | ======================== | 
|  | 31 |  | 
|  | 32 |  | 
|  | 33 | Example reclass | 
|  | 34 | =============== | 
|  | 35 |  | 
|  | 36 | Simple Apache proxy | 
|  | 37 |  | 
|  | 38 | .. code-block:: yaml | 
|  | 39 |  | 
|  | 40 | apache: | 
|  | 41 | server: | 
|  | 42 | enabled: true | 
|  | 43 | bind: | 
|  | 44 | address: '0.0.0.0' | 
|  | 45 | ports: | 
|  | 46 | - 80 | 
|  | 47 | modules: | 
|  | 48 | - proxy | 
|  | 49 | - proxy_http | 
|  | 50 | - proxy_balancer | 
|  | 51 |  | 
|  | 52 |  | 
|  | 53 | Apache plain static sites (eg. sphinx generated, from git/hg sources) | 
|  | 54 |  | 
|  | 55 | .. code-block:: yaml | 
|  | 56 |  | 
|  | 57 | apache: | 
|  | 58 | server: | 
|  | 59 | enabled: true | 
|  | 60 | bind: | 
|  | 61 | address: '0.0.0.0' | 
|  | 62 | ports: | 
|  | 63 | - 80 | 
|  | 64 | modules: | 
|  | 65 | - rewrite | 
|  | 66 | - status | 
|  | 67 | site: | 
|  | 68 | - enabled: true | 
|  | 69 | name: 'sphinxdoc' | 
|  | 70 | type: 'static' | 
|  | 71 | host: | 
|  | 72 | name: 'doc.domain.com' | 
|  | 73 | port: 80 | 
|  | 74 | source: | 
|  | 75 | engine: local | 
|  | 76 | - enabled: true | 
|  | 77 | name: 'impressjs' | 
|  | 78 | type: 'static' | 
|  | 79 | host: | 
|  | 80 | name: 'pres.domain.com' | 
|  | 81 | port: 80 | 
|  | 82 | source: | 
|  | 83 | engine: git | 
|  | 84 | address: 'git@repo1.domain.cz:impress/billometer.git' | 
|  | 85 | revision: 'master' | 
|  | 86 |  | 
| Filip Pytloun | c135fa5 | 2015-11-25 12:28:45 +0100 | [diff] [blame] | 87 | Tune settings of mpm_prefork | 
|  | 88 |  | 
|  | 89 | .. code-block:: yaml | 
|  | 90 |  | 
|  | 91 | parameters: | 
|  | 92 | apache: | 
|  | 93 | mpm: | 
|  | 94 | prefork: | 
|  | 95 | max_clients: 250 | 
|  | 96 | servers: | 
|  | 97 | min: 32 | 
|  | 98 | max: 64 | 
|  | 99 | max_requests: 4000 | 
|  | 100 |  | 
| Filip Pytloun | 590b579 | 2016-01-27 11:24:29 +0100 | [diff] [blame] | 101 | Apache kerberos authentication: | 
|  | 102 |  | 
|  | 103 | .. code-block:: yaml | 
|  | 104 |  | 
|  | 105 | parameters | 
|  | 106 | apache: | 
|  | 107 | server: | 
|  | 108 | site: | 
|  | 109 | auth: | 
|  | 110 | engine: kerberos | 
|  | 111 | name: "Kerberos Authentication" | 
|  | 112 | require: | 
|  | 113 | - "ldap-attribute memberOf='cn=somegroup,cn=groups,cn=accounts,dc=example,dc=com'" | 
|  | 114 |  | 
|  | 115 | kerberos: | 
|  | 116 | realms: | 
|  | 117 | - EXAMPLE.COM | 
|  | 118 | # Bellow is optional | 
|  | 119 | keytab: /etc/apache2/ipa.keytab | 
|  | 120 | service: HTTP | 
|  | 121 | method: | 
|  | 122 | negotiate: true | 
|  | 123 | k5passwd: true | 
|  | 124 |  | 
|  | 125 | ldap: | 
|  | 126 | url: "ldaps://idm01.example.com/dc=example,dc=com?krbPrincipalName" | 
|  | 127 | # mech is optional | 
|  | 128 | mech: GSSAPI | 
|  | 129 |  | 
| Filip Pytloun | 3179bca | 2016-02-22 13:39:58 +0100 | [diff] [blame] | 130 | Tune security settings (these are default): | 
|  | 131 |  | 
|  | 132 | .. code-block:: yaml | 
|  | 133 |  | 
|  | 134 | parameters: | 
|  | 135 | apache: | 
|  | 136 | server: | 
|  | 137 | # ServerTokens | 
|  | 138 | tokens: Prod | 
| Filip Pytloun | affb18d | 2016-02-22 13:58:27 +0100 | [diff] [blame] | 139 | # ServerSignature, can be also set per-site | 
|  | 140 | signature: false | 
|  | 141 | # TraceEnable, can be also set per-site | 
|  | 142 | trace: false | 
|  | 143 | # Deny access to .git, .svn, .hg directories | 
|  | 144 | secure_scm: true | 
|  | 145 | # Required for settings bellow | 
|  | 146 | modules: | 
|  | 147 | - headers | 
|  | 148 | # Set X-Content-Type-Options | 
|  | 149 | content_type_options: nosniff | 
|  | 150 | # Set X-Frame-Options | 
|  | 151 | frame_options: sameorigin | 
| Filip Pytloun | 3179bca | 2016-02-22 13:39:58 +0100 | [diff] [blame] | 152 |  | 
| Filip Pytloun | 410abc4 | 2015-10-06 16:28:31 +0200 | [diff] [blame] | 153 | Example pillar | 
|  | 154 | ============== | 
|  | 155 |  | 
|  | 156 | Roundcube webmail, postfixadmin and mailman | 
|  | 157 |  | 
|  | 158 | .. code-block:: yaml | 
|  | 159 |  | 
|  | 160 | classes: | 
|  | 161 | - service.apache.server.single | 
|  | 162 | parameters: | 
|  | 163 | apache: | 
|  | 164 | server: | 
| jan kaufman | 75aae5c | 2016-01-26 14:49:12 +0100 | [diff] [blame] | 165 | enabled: true | 
| Filip Pytloun | 410abc4 | 2015-10-06 16:28:31 +0200 | [diff] [blame] | 166 | modules: | 
|  | 167 | - cgi | 
|  | 168 | - php | 
|  | 169 | site: | 
|  | 170 | roundcube: | 
|  | 171 | enabled: true | 
|  | 172 | type: static | 
|  | 173 | name: roundcube | 
|  | 174 | root: /usr/share/roundcube | 
|  | 175 | locations: | 
|  | 176 | - uri: /admin | 
|  | 177 | path: /usr/share/postfixadmin | 
|  | 178 | - uri: /mailman | 
|  | 179 | path: /usr/lib/cgi-bin/mailman | 
|  | 180 | script: true | 
|  | 181 | - uri: /pipermail | 
|  | 182 | path: /var/lib/mailman/archives/public | 
|  | 183 | - uri: /images/mailman | 
|  | 184 | path: /usr/share/images/mailman | 
|  | 185 | host: | 
|  | 186 | name: mail.example.com | 
|  | 187 | aliases: | 
|  | 188 | - mail.example.com | 
|  | 189 | - lists.example.com | 
|  | 190 | - mail01.example.com | 
|  | 191 | - mail01 | 
|  | 192 |  | 
|  | 193 | Read more | 
|  | 194 | ========= | 
|  | 195 |  | 
|  | 196 | * https://httpd.apache.org/docs/ |