Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1 | |
Aleš Komárek | 296a844 | 2017-04-11 13:22:35 +0200 | [diff] [blame] | 2 | ============= |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 3 | Usage |
Aleš Komárek | 296a844 | 2017-04-11 13:22:35 +0200 | [diff] [blame] | 4 | ============= |
Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 5 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 6 | Nginx is an open source reverse proxy server for HTTP, HTTPS, |
| 7 | SMTP, POP3, and IMAP protocols, as well as a load balancer, |
| 8 | HTTP cache, and a web server (origin server). The nginx project |
| 9 | started with a strong focus on high concurrency, high performance |
| 10 | and low memory usage. |
Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 11 | |
Aleš Komárek | 296a844 | 2017-04-11 13:22:35 +0200 | [diff] [blame] | 12 | Sample Pillars |
Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 13 | ============== |
| 14 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 15 | Gitlab server setup: |
Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 16 | |
| 17 | .. code-block:: yaml |
| 18 | |
| 19 | nginx: |
| 20 | server: |
| 21 | enabled: true |
| 22 | bind: |
| 23 | address: '0.0.0.0' |
| 24 | ports: |
| 25 | - 80 |
| 26 | site: |
| 27 | gitlab_domain: |
| 28 | enabled: true |
| 29 | type: gitlab |
| 30 | name: domain |
| 31 | ssl: |
| 32 | enabled: true |
| 33 | key: | |
| 34 | -----BEGIN RSA PRIVATE KEY----- |
| 35 | ... |
| 36 | cert: | |
| 37 | xyz |
| 38 | chain: | |
| 39 | my_chain.. |
| 40 | host: |
| 41 | name: gitlab.domain.com |
| 42 | port: 80 |
| 43 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 44 | Simple static HTTP site: |
Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 45 | |
| 46 | .. code-block:: yaml |
| 47 | |
| 48 | nginx: |
| 49 | server: |
| 50 | site: |
| 51 | nginx_static_site01: |
| 52 | enabled: true |
Niklaus Giger | 23096b2 | 2017-06-30 16:41:49 +0200 | [diff] [blame] | 53 | type: nginx_static |
Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 54 | name: site01 |
| 55 | host: |
| 56 | name: gitlab.domain.com |
| 57 | port: 80 |
| 58 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 59 | Simple load balancer: |
Dmitry Stremkovskiy | 52145c6 | 2017-08-21 23:42:17 +0300 | [diff] [blame] | 60 | |
| 61 | .. code-block:: yaml |
| 62 | |
| 63 | nginx: |
| 64 | server: |
| 65 | upstream: |
| 66 | horizon-upstream: |
| 67 | backend1: |
| 68 | address: 10.10.10.113 |
| 69 | port: 8078 |
| 70 | opts: weight=3 |
| 71 | backend2: |
| 72 | address: 10.10.10.114 |
| 73 | site: |
| 74 | nginx_proxy_openstack_web: |
| 75 | enabled: true |
| 76 | type: nginx_proxy |
| 77 | name: openstack_web |
| 78 | proxy: |
| 79 | upstream_proxy_pass: http://horizon-upstream |
| 80 | host: |
| 81 | name: 192.168.0.1 |
| 82 | port: 31337 |
| 83 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 84 | Static site with access policy: |
Adam Tengler | e7746cb | 2016-04-27 19:01:25 +0200 | [diff] [blame] | 85 | |
| 86 | .. code-block:: yaml |
| 87 | |
| 88 | nginx: |
| 89 | server: |
| 90 | site: |
| 91 | nginx_static_site01: |
| 92 | enabled: true |
Niklaus Giger | 23096b2 | 2017-06-30 16:41:49 +0200 | [diff] [blame] | 93 | type: nginx_static |
Adam Tengler | e7746cb | 2016-04-27 19:01:25 +0200 | [diff] [blame] | 94 | name: site01 |
| 95 | access_policy: |
| 96 | allow: |
| 97 | - 192.168.1.1/24 |
| 98 | - 127.0.0.1 |
| 99 | deny: |
| 100 | - 192.168.1.2 |
| 101 | - all |
| 102 | host: |
| 103 | name: gitlab.domain.com |
| 104 | port: 80 |
| 105 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 106 | Simple TCP/UDP proxy: |
Dmitry Stremkovskiy | 6484afa | 2017-08-22 17:07:06 +0300 | [diff] [blame] | 107 | |
| 108 | .. code-block:: yaml |
| 109 | |
| 110 | nginx: |
| 111 | server: |
| 112 | stream: |
| 113 | rabbitmq: |
| 114 | host: |
| 115 | port: 5672 |
| 116 | backend: |
| 117 | server1: |
| 118 | address: 10.10.10.113 |
| 119 | port: 5672 |
| 120 | least_conn: true |
| 121 | hash: "$remote_addr consistent" |
| 122 | unbound: |
| 123 | host: |
| 124 | bind: 127.0.0.1 |
| 125 | port: 53 |
| 126 | protocol: udp |
| 127 | backend: |
| 128 | server1: |
| 129 | address: 10.10.10.113 |
| 130 | port: 5353 |
| 131 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 132 | Simple HTTP proxy: |
Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 133 | |
| 134 | .. code-block:: yaml |
| 135 | |
| 136 | nginx: |
| 137 | server: |
| 138 | site: |
| 139 | nginx_proxy_site01: |
| 140 | enabled: true |
Niklaus Giger | 23096b2 | 2017-06-30 16:41:49 +0200 | [diff] [blame] | 141 | type: nginx_proxy |
Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 142 | name: site01 |
| 143 | proxy: |
| 144 | host: local.domain.com |
| 145 | port: 80 |
| 146 | protocol: http |
| 147 | host: |
| 148 | name: gitlab.domain.com |
| 149 | port: 80 |
| 150 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 151 | Simple HTTP proxy with multiple locations: |
| 152 | |
| 153 | .. note:: If proxy part is defined and location is missing ``/``, |
| 154 | the proxy part is used. If the ``/`` location is defined, |
| 155 | it overrides the proxy part. |
Jakub Josef | 83f7acf | 2018-04-09 16:05:49 +0200 | [diff] [blame] | 156 | |
| 157 | .. code-block:: yaml |
| 158 | |
| 159 | nginx: |
| 160 | server: |
| 161 | site: |
| 162 | nginx_proxy_site01: |
| 163 | enabled: true |
| 164 | type: nginx_proxy |
| 165 | name: site01 |
| 166 | proxy: |
| 167 | host: local.domain.com |
| 168 | port: 80 |
| 169 | protocol: http |
| 170 | location: |
| 171 | /internal/: |
| 172 | host: 172.120.10.200 |
| 173 | port: 80 |
| 174 | protocol: http |
| 175 | /doc/: |
| 176 | host: 172.10.10.200 |
| 177 | port: 80 |
| 178 | protocol: http |
| 179 | host: |
| 180 | name: gitlab.domain.com |
| 181 | port: 80 |
| 182 | |
| 183 | .. code-block:: yaml |
| 184 | |
| 185 | nginx: |
| 186 | server: |
| 187 | site: |
| 188 | nginx_proxy_site01: |
| 189 | enabled: true |
| 190 | type: nginx_proxy |
| 191 | name: site01 |
| 192 | location: |
| 193 | /: |
| 194 | host: 172.120.10.200 |
| 195 | port: 80 |
| 196 | protocol: http |
| 197 | /doc/: |
| 198 | host: 172.10.10.200 |
| 199 | port: 80 |
| 200 | protocol: http |
| 201 | host: |
| 202 | name: gitlab.domain.com |
| 203 | port: 80 |
| 204 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 205 | Simple Websocket proxy: |
Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 206 | |
| 207 | .. code-block:: yaml |
| 208 | |
| 209 | nginx: |
| 210 | server: |
| 211 | site: |
| 212 | nginx_proxy_site02: |
| 213 | enabled: true |
Niklaus Giger | 23096b2 | 2017-06-30 16:41:49 +0200 | [diff] [blame] | 214 | type: nginx_proxy |
Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 215 | name: site02 |
| 216 | proxy: |
| 217 | websocket: true |
| 218 | host: local.domain.com |
| 219 | port: 80 |
| 220 | protocol: http |
| 221 | host: |
| 222 | name: gitlab.domain.com |
| 223 | port: 80 |
| 224 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 225 | Content filtering proxy: |
Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 226 | |
| 227 | .. code-block:: yaml |
| 228 | |
| 229 | nginx: |
| 230 | server: |
| 231 | enabled: true |
| 232 | site: |
| 233 | nginx_proxy_site03: |
| 234 | enabled: true |
Niklaus Giger | 23096b2 | 2017-06-30 16:41:49 +0200 | [diff] [blame] | 235 | type: nginx_proxy |
Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 236 | name: site03 |
| 237 | proxy: |
| 238 | host: local.domain.com |
| 239 | port: 80 |
| 240 | protocol: http |
| 241 | filter: |
| 242 | search: https://www.domain.com |
| 243 | replace: http://10.10.10.10 |
| 244 | host: |
| 245 | name: gitlab.domain.com |
| 246 | port: 80 |
| 247 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 248 | Proxy with access policy: |
Adam Tengler | e7746cb | 2016-04-27 19:01:25 +0200 | [diff] [blame] | 249 | |
| 250 | .. code-block:: yaml |
| 251 | |
| 252 | nginx: |
| 253 | server: |
| 254 | site: |
| 255 | nginx_proxy_site01: |
| 256 | enabled: true |
Niklaus Giger | 23096b2 | 2017-06-30 16:41:49 +0200 | [diff] [blame] | 257 | type: nginx_proxy |
Adam Tengler | e7746cb | 2016-04-27 19:01:25 +0200 | [diff] [blame] | 258 | name: site01 |
| 259 | access_policy: |
| 260 | allow: |
| 261 | - 192.168.1.1/24 |
| 262 | - 127.0.0.1 |
| 263 | deny: |
| 264 | - 192.168.1.2 |
| 265 | - all |
| 266 | proxy: |
| 267 | host: local.domain.com |
| 268 | port: 80 |
| 269 | protocol: http |
| 270 | host: |
| 271 | name: gitlab.domain.com |
| 272 | port: 80 |
| 273 | |
Vasyl Saienko | c14eca2 | 2018-12-07 09:46:17 +0000 | [diff] [blame] | 274 | Use nginx `ngx_http_map_module` that creates variables whose values depend on |
| 275 | values of other variables. |
Michel Nederlof | eb5dd23 | 2018-03-13 13:57:34 +0100 | [diff] [blame] | 276 | |
| 277 | .. code-block:: yaml |
| 278 | |
Vasyl Saienko | c14eca2 | 2018-12-07 09:46:17 +0000 | [diff] [blame] | 279 | nginx: |
| 280 | server: |
| 281 | enabled: true |
| 282 | map: |
| 283 | enabled: true |
| 284 | items: |
| 285 | mymap: |
| 286 | enabled: true |
| 287 | string: input_string |
| 288 | variable: output_map_variable |
| 289 | body: |
| 290 | default: |
| 291 | value: '""' |
| 292 | example.com: |
| 293 | value: '1' |
| 294 | example.org: |
| 295 | value: '2' |
| 296 | |
| 297 | Use nginx `ngx_http_geo_module module` that creates variables with values |
| 298 | depending on the client IP address. |
| 299 | |
| 300 | .. code-block:: yaml |
| 301 | |
| 302 | nginx: |
| 303 | server: |
| 304 | enabled: true |
| 305 | geo: |
| 306 | enabled: true |
| 307 | items: |
| 308 | my_geo_map: |
| 309 | enabled: true |
| 310 | variable: output_get_variable |
| 311 | body: |
| 312 | default: |
| 313 | value: '""' |
| 314 | cl1 |
| 315 | name: 10.12.100.1/32 |
| 316 | value: '1' |
| 317 | cl2 |
| 318 | name: 10.13.0.0/16 |
| 319 | value: 2' |
| 320 | |
| 321 | Use `ngx_http_limit_req_module` module that is used to limit the request |
| 322 | processing rate per a defined key, in particular, the processing rate of |
| 323 | requests coming from a single IP address. The limitation is done using |
| 324 | the `leaky bucket` method. |
| 325 | The `limit_req_module` might be configured globally or applied to specific |
| 326 | nginx site. |
| 327 | |
| 328 | .. code-block:: yaml |
| 329 | |
| 330 | nginx: |
| 331 | server: |
| 332 | limit_req_module: |
| 333 | limit_req_zone: |
| 334 | global_limit_ip_zone: |
| 335 | key: global_limit_ip_var |
| 336 | size: 10m |
| 337 | rate: '1r/s' |
| 338 | limit_req_status: 503 |
| 339 | limit_req: |
| 340 | global_limit_zone: |
| 341 | burst: 5 |
| 342 | enabled: true |
| 343 | |
| 344 | There is an example to to limit requests to all sites based on IP. |
| 345 | In the following example all clients are limited except of 10.12.100.1 |
| 346 | with 1 req per second. |
| 347 | |
| 348 | #. Create geo instance that will match IP and set `limit_action` var. |
| 349 | "0" - is unlimited, 1 - limited |
| 350 | |
| 351 | #. Create a `global_geo_limiting_map` that will map `ip_limit_key` to |
| 352 | `ip_limit_action` |
| 353 | |
| 354 | #. Create global `limit_req_zone` called `global_limit_zone` that limits |
| 355 | number of requests to 1r/s |
| 356 | |
| 357 | #. Apply `global_limit_zone` globally to all requests with 5 req burst. |
| 358 | |
| 359 | .. code-block:: yaml |
| 360 | |
| 361 | nginx: |
| 362 | server: |
| 363 | enabled: true |
| 364 | geo: |
| 365 | enabled: true |
| 366 | items: |
| 367 | global_geo_limiting: |
| 368 | enabled: true |
| 369 | variable: ip_limit_key |
| 370 | body: |
| 371 | default: |
| 372 | value: '1' |
| 373 | unlimited_client1: |
| 374 | name: '10.12.100.1/32' |
| 375 | value: '0' |
| 376 | map: |
| 377 | enabled: true |
| 378 | items: |
| 379 | global_geo_limiting_map: |
| 380 | enabled: true |
| 381 | string: ip_limit_key |
| 382 | variable: ip_limit_action |
| 383 | body: |
| 384 | limited: |
| 385 | name: 1 |
| 386 | value: '$binary_remote_addr' |
| 387 | unlimited: |
| 388 | name: 0 |
| 389 | value: '""' |
| 390 | limit_req_module: |
| 391 | limit_req_zone: |
| 392 | global_limit_zone: |
| 393 | key: ip_limit_action |
| 394 | size: 10m |
| 395 | rate: '1r/s' |
| 396 | limit_req_status: 503 |
| 397 | limit_req: |
| 398 | global_limit_zone: |
| 399 | burst: 5 |
| 400 | enabled: true |
| 401 | |
| 402 | To apply request limiting to particular site only `limit_req` should be |
| 403 | applied on site level, for example: |
| 404 | |
| 405 | .. code-block:: yaml |
| 406 | |
Michel Nederlof | eb5dd23 | 2018-03-13 13:57:34 +0100 | [diff] [blame] | 407 | nginx: |
| 408 | server: |
| 409 | site: |
Vasyl Saienko | c14eca2 | 2018-12-07 09:46:17 +0000 | [diff] [blame] | 410 | nginx_proxy_openstack_api_keystone: |
| 411 | limit_req_module: |
| 412 | limit_req: |
| 413 | global_limit_zone: |
| 414 | burst: 5 |
| 415 | enabled: true |
| 416 | |
Michel Nederlof | eb5dd23 | 2018-03-13 13:57:34 +0100 | [diff] [blame] | 417 | |
Oleksandr Bryndzii | a26617c | 2018-12-07 17:36:42 +0000 | [diff] [blame] | 418 | Use `ngx_http_limit_conn_module` module that is used to set the shared memory |
| 419 | zone and the maximum allowed number of connections for a given key value. |
| 420 | The `limit_conn_module` might be configured globally or applied to specific |
| 421 | nginx site. |
| 422 | |
| 423 | .. code-block:: yaml |
| 424 | |
| 425 | nginx: |
| 426 | server: |
| 427 | limit_conn_module: |
| 428 | limit_conn_zone: |
| 429 | global_limit_conn_zone: |
| 430 | key: 'binary_remote_addr' |
| 431 | size: 10m |
| 432 | limit_conn_status: 503 |
| 433 | limit_conn: |
| 434 | global_limit_conn_zone: |
| 435 | connection: 50 |
| 436 | enabled: true |
| 437 | |
| 438 | |
| 439 | To apply connection limiting to particular site only `limit_conn` should be |
| 440 | applied on site level, for example: |
| 441 | |
| 442 | .. code-block:: yaml |
| 443 | |
| 444 | nginx: |
| 445 | server: |
| 446 | site: |
| 447 | nginx_proxy_openstack_web: |
| 448 | limit_conn_module: |
| 449 | limit_conn: |
| 450 | global_limit_conn_zone: |
| 451 | connections: 25 |
| 452 | enabled: true |
| 453 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 454 | Gitlab server with user for basic auth: |
Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 455 | |
| 456 | .. code-block:: yaml |
| 457 | |
| 458 | nginx: |
| 459 | server: |
| 460 | enabled: true |
| 461 | user: |
| 462 | username1: |
| 463 | enabled: true |
| 464 | password: magicunicorn |
| 465 | htpasswd: htpasswd-site1 |
| 466 | username2: |
| 467 | enabled: true |
| 468 | password: magicunicorn |
| 469 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 470 | Proxy buffering: |
Ales Komarek | d77b797 | 2015-11-12 11:02:39 +0100 | [diff] [blame] | 471 | |
| 472 | .. code-block:: yaml |
| 473 | |
| 474 | nginx: |
| 475 | server: |
| 476 | enabled: true |
| 477 | bind: |
| 478 | address: '0.0.0.0' |
| 479 | ports: |
| 480 | - 80 |
| 481 | site: |
| 482 | gitlab_proxy: |
| 483 | enabled: true |
Niklaus Giger | 23096b2 | 2017-06-30 16:41:49 +0200 | [diff] [blame] | 484 | type: nginx_proxy |
Ales Komarek | d77b797 | 2015-11-12 11:02:39 +0100 | [diff] [blame] | 485 | proxy: |
Ondrej Smola | 5e177bc | 2017-12-07 12:55:23 +0100 | [diff] [blame] | 486 | request_buffer: false |
Ales Komarek | d77b797 | 2015-11-12 11:02:39 +0100 | [diff] [blame] | 487 | buffer: |
| 488 | number: 8 |
| 489 | size: 16 |
| 490 | host: |
| 491 | name: gitlab.domain.com |
| 492 | port: 80 |
| 493 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 494 | Let's Encrypt: |
Michael Kutý | 3a5abf1 | 2015-12-04 21:03:33 +0100 | [diff] [blame] | 495 | |
| 496 | .. code-block:: yaml |
| 497 | |
| 498 | nginx: |
| 499 | server: |
| 500 | enabled: true |
| 501 | bind: |
| 502 | address: '0.0.0.0' |
| 503 | ports: |
| 504 | - 443 |
| 505 | site: |
| 506 | gitlab_domain: |
| 507 | enabled: true |
| 508 | type: gitlab |
| 509 | name: domain |
| 510 | ssl: |
| 511 | enabled: true |
| 512 | engine: letsencrypt |
| 513 | host: |
| 514 | name: gitlab.domain.com |
| 515 | port: 443 |
| 516 | |
Filip Pytloun | e0f7551 | 2016-11-03 14:34:26 +0100 | [diff] [blame] | 517 | SSL using already deployed key and cert file. |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 518 | |
| 519 | .. note:: The cert file should already contain CA cert and |
| 520 | complete chain. |
Filip Pytloun | e0f7551 | 2016-11-03 14:34:26 +0100 | [diff] [blame] | 521 | |
| 522 | .. code-block:: yaml |
| 523 | |
| 524 | nginx: |
| 525 | server: |
| 526 | enabled: true |
| 527 | site: |
| 528 | mysite: |
| 529 | ssl: |
| 530 | enabled: true |
| 531 | key_file: /etc/ssl/private/mykey.key |
| 532 | cert_file: /etc/ssl/cert/mycert.crt |
| 533 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 534 | Advanced SSL configuration, more information about SSL option |
| 535 | may be found at http://nginx.org/en/docs/http/ngx_http_ssl_module.html |
| 536 | |
| 537 | .. note:: Prior to nginx 1.11.0, only one type of ecdh curve |
| 538 | can be applied in ``ssl_ecdh_curve directive``. |
| 539 | |
| 540 | if mode = ``secure`` or mode = ``normal`` and ``ciphers`` |
| 541 | or ``protocols`` are set, they should have type ``string``. |
| 542 | If mode = ``manual``, their type should be ``dict`` |
| 543 | as shown below. |
Vasyl Saienko | d3348f6 | 2018-02-09 20:08:01 +0200 | [diff] [blame] | 544 | |
| 545 | .. code-block:: yaml |
| 546 | |
| 547 | nginx: |
| 548 | server: |
| 549 | enabled: true |
| 550 | site: |
| 551 | mysite: |
| 552 | ssl: |
| 553 | enabled: true |
| 554 | mode: 'manual' |
| 555 | key_file: /srv/salt/pki/${_param:cluster_name}/${salt:minion:cert:proxy:common_name}.key |
| 556 | cert_file: /srv/salt/pki/${_param:cluster_name}/${salt:minion:cert:proxy:common_name}.crt |
| 557 | chain_file: /srv/salt/pki/${_param:cluster_name}/${salt:minion:cert:proxy:common_name}-with-chain.crt |
| 558 | protocols: |
| 559 | TLS1: |
| 560 | name: 'TLSv1' |
| 561 | enabled: True |
| 562 | TLS1_1: |
| 563 | name: 'TLSv1.1' |
| 564 | enabled: True |
| 565 | TLS1_2: |
| 566 | name: 'TLSv1.2' |
| 567 | enabled: False |
| 568 | ciphers: |
| 569 | ECDHE_RSA_AES256_GCM_SHA384: |
| 570 | name: 'ECDHE-RSA-AES256-GCM-SHA384' |
| 571 | enabled: True |
| 572 | ECDHE_ECDSA_AES256_GCM_SHA384: |
| 573 | name: 'ECDHE-ECDSA-AES256-GCM-SHA384' |
| 574 | enabled: True |
| 575 | buffer_size: '16k' |
| 576 | crl: |
| 577 | file: '/etc/ssl/crl.pem' |
| 578 | enabled: False |
| 579 | dhparam: |
| 580 | enabled: True |
| 581 | numbits: 2048 |
azvyagintsev | 4f4e7d4 | 2019-01-24 13:44:55 +0200 | [diff] [blame] | 582 | use_dsaparam: True |
Vasyl Saienko | d3348f6 | 2018-02-09 20:08:01 +0200 | [diff] [blame] | 583 | ecdh_curve: |
| 584 | secp384r1: |
| 585 | name: 'secp384r1' |
| 586 | enabled: False |
| 587 | secp521r1: |
| 588 | name: 'secp521r1' |
| 589 | enabled: True |
| 590 | password_file: |
| 591 | content: 'testcontent22' |
| 592 | enabled: True |
| 593 | file: '/etc/ssl/password.key' |
| 594 | prefer_server_ciphers: 'on' |
| 595 | ticket_key: |
| 596 | enabled: True |
| 597 | numbytes: 48 |
| 598 | resolver: |
| 599 | address: '127.0.0.1' |
| 600 | valid_seconds: '500' |
| 601 | timeout_seconds: '60' |
| 602 | session_tickets: 'on' |
| 603 | stapling: 'off' |
| 604 | stapling_file: '/path/to/stapling/file' |
| 605 | stapling_responder: 'http://ocsp.example.com/' |
| 606 | stapling_verify: 'on' |
| 607 | verify_client: 'on' |
| 608 | client_certificate: |
| 609 | file: '/etc/ssl/client_cert.pem' |
| 610 | enabled: False |
| 611 | verify_depth: 1 |
| 612 | session_cache: 'shared:SSL:15m' |
| 613 | session_timeout: '15m' |
Adam Tengler | 5c64af6 | 2018-06-22 12:17:55 +0000 | [diff] [blame] | 614 | strict_transport_security: |
| 615 | max_age: 16000000 |
| 616 | include_subdomains: False |
| 617 | always: true |
| 618 | enabled: true |
Vasyl Saienko | d3348f6 | 2018-02-09 20:08:01 +0200 | [diff] [blame] | 619 | |
Vasyl Saienko | f5c57e2 | 2018-09-28 08:54:33 +0000 | [diff] [blame] | 620 | Setting custom proxy headers: |
| 621 | |
| 622 | .. code-block:: yaml |
| 623 | |
| 624 | nginx: |
| 625 | server: |
| 626 | enabled: true |
| 627 | site: |
| 628 | custom_headers: |
| 629 | type: nginx_proxy |
| 630 | proxy_set_header: |
| 631 | Host: |
| 632 | enabled: true |
| 633 | value: "$host:8774" |
| 634 | X-Real-IP: |
| 635 | enabled: true |
| 636 | value: '$remote_addr' |
| 637 | X-Forwarded-For: |
| 638 | enabled: true |
| 639 | value: '$proxy_add_x_forwarded_for' |
| 640 | X-Forwarded-Proto: |
| 641 | enabled: true |
| 642 | value: '$scheme' |
| 643 | X-Forwarded-Port: |
| 644 | enabled: true |
| 645 | value: '$server_port' |
| 646 | |
Dzmitry Stremkouski | 1377246 | 2018-10-27 14:56:47 +0200 | [diff] [blame] | 647 | Define site catalog indexes: |
| 648 | |
| 649 | .. code-block:: yaml |
| 650 | |
| 651 | nginx: |
| 652 | server: |
| 653 | enabled: true |
| 654 | site: |
| 655 | nginx_catalog: |
| 656 | enabled: true |
| 657 | type: nginx_static |
| 658 | name: server |
| 659 | indexes: |
| 660 | - index.htm |
| 661 | - index.html |
| 662 | host: |
| 663 | name: 127.0.0.1 |
| 664 | port: 80 |
| 665 | |
| 666 | Define site catalog autoindex: |
| 667 | |
| 668 | .. code-block:: yaml |
| 669 | |
| 670 | nginx: |
| 671 | server: |
| 672 | enabled: true |
| 673 | site: |
| 674 | nginx_catalog: |
| 675 | enabled: true |
| 676 | type: nginx_static |
| 677 | name: server |
| 678 | autoindex: True |
| 679 | host: |
| 680 | name: 127.0.0.1 |
| 681 | port: 80 |
| 682 | |
| 683 | Nginx stats server (required by collectd nginx plugin) (DEPRECATED): |
Adam Tengler | c391657 | 2016-01-25 17:46:52 +0100 | [diff] [blame] | 684 | |
Aleš Komárek | 296a844 | 2017-04-11 13:22:35 +0200 | [diff] [blame] | 685 | .. code-block:: yaml |
Adam Tengler | c391657 | 2016-01-25 17:46:52 +0100 | [diff] [blame] | 686 | |
| 687 | nginx: |
| 688 | server: |
| 689 | enabled: true |
| 690 | site: |
| 691 | nginx_stats_server: |
| 692 | enabled: true |
| 693 | type: nginx_stats |
| 694 | name: server |
| 695 | host: |
| 696 | name: 127.0.0.1 |
| 697 | port: 8888 |
| 698 | |
Dzmitry Stremkouski | 1377246 | 2018-10-27 14:56:47 +0200 | [diff] [blame] | 699 | or: |
| 700 | |
| 701 | .. code-block:: yaml |
| 702 | |
| 703 | nginx: |
| 704 | server: |
| 705 | enabled: true |
| 706 | site: |
| 707 | nginx_stats_server: |
| 708 | enabled: true |
| 709 | root: disabled |
| 710 | indexes: [] |
| 711 | stats: True |
| 712 | type: nginx_static |
| 713 | name: stat_server |
| 714 | host: |
| 715 | name: 127.0.0.1 |
| 716 | address: 127.0.0.1 |
| 717 | port: 8888 |
| 718 | |
OlgaGusarenko | e2f808f | 2018-07-30 23:42:18 +0300 | [diff] [blame] | 719 | Nginx configured to wait for another service/s before |
| 720 | starting (currently only with systemd): |
Adam Tengler | 8689394 | 2018-06-20 14:06:24 +0000 | [diff] [blame] | 721 | |
| 722 | .. code-block:: yaml |
| 723 | |
| 724 | nginx: |
| 725 | server: |
| 726 | wait_for_service: |
| 727 | - foo-bar.mount |
| 728 | enabled: true |
| 729 | site: |
| 730 | ... |
| 731 | |
Aleš Komárek | 296a844 | 2017-04-11 13:22:35 +0200 | [diff] [blame] | 732 | More Information |
| 733 | ================ |
Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 734 | |
| 735 | * http://wiki.nginx.org/Main |
| 736 | * https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility |
| 737 | * http://nginx.com/resources/admin-guide/reverse-proxy/ |
| 738 | * https://mozilla.github.io/server-side-tls/ssl-config-generator/ |