Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 1 | |
| 2 | ===== |
| 3 | Nginx |
| 4 | ===== |
| 5 | |
| 6 | Nginx is an open source reverse proxy server for HTTP, HTTPS, SMTP, POP3, and IMAP protocols, as well as a load balancer, HTTP cache, and a web server (origin server). The nginx project started with a strong focus on high concurrency, high performance and low memory usage. |
| 7 | |
| 8 | Sample pillars |
| 9 | ============== |
| 10 | |
| 11 | Gitlab server setup |
| 12 | |
| 13 | .. code-block:: yaml |
| 14 | |
| 15 | nginx: |
| 16 | server: |
| 17 | enabled: true |
| 18 | bind: |
| 19 | address: '0.0.0.0' |
| 20 | ports: |
| 21 | - 80 |
| 22 | site: |
| 23 | gitlab_domain: |
| 24 | enabled: true |
| 25 | type: gitlab |
| 26 | name: domain |
| 27 | ssl: |
| 28 | enabled: true |
| 29 | key: | |
| 30 | -----BEGIN RSA PRIVATE KEY----- |
| 31 | ... |
| 32 | cert: | |
| 33 | xyz |
| 34 | chain: | |
| 35 | my_chain.. |
| 36 | host: |
| 37 | name: gitlab.domain.com |
| 38 | port: 80 |
| 39 | |
| 40 | Simple static HTTP site |
| 41 | |
| 42 | .. code-block:: yaml |
| 43 | |
| 44 | nginx: |
| 45 | server: |
| 46 | site: |
| 47 | nginx_static_site01: |
| 48 | enabled: true |
| 49 | type: static |
| 50 | name: site01 |
| 51 | host: |
| 52 | name: gitlab.domain.com |
| 53 | port: 80 |
| 54 | |
| 55 | Simple HTTP proxy |
| 56 | |
| 57 | .. code-block:: yaml |
| 58 | |
| 59 | nginx: |
| 60 | server: |
| 61 | site: |
| 62 | nginx_proxy_site01: |
| 63 | enabled: true |
| 64 | type: proxy |
| 65 | name: site01 |
| 66 | proxy: |
| 67 | host: local.domain.com |
| 68 | port: 80 |
| 69 | protocol: http |
| 70 | host: |
| 71 | name: gitlab.domain.com |
| 72 | port: 80 |
| 73 | |
| 74 | Simple Websocket proxy |
| 75 | |
| 76 | .. code-block:: yaml |
| 77 | |
| 78 | nginx: |
| 79 | server: |
| 80 | site: |
| 81 | nginx_proxy_site02: |
| 82 | enabled: true |
| 83 | type: proxy |
| 84 | name: site02 |
| 85 | proxy: |
| 86 | websocket: true |
| 87 | host: local.domain.com |
| 88 | port: 80 |
| 89 | protocol: http |
| 90 | host: |
| 91 | name: gitlab.domain.com |
| 92 | port: 80 |
| 93 | |
| 94 | Content filtering proxy |
| 95 | |
| 96 | .. code-block:: yaml |
| 97 | |
| 98 | nginx: |
| 99 | server: |
| 100 | enabled: true |
| 101 | site: |
| 102 | nginx_proxy_site03: |
| 103 | enabled: true |
| 104 | type: proxy |
| 105 | name: site03 |
| 106 | proxy: |
| 107 | host: local.domain.com |
| 108 | port: 80 |
| 109 | protocol: http |
| 110 | filter: |
| 111 | search: https://www.domain.com |
| 112 | replace: http://10.10.10.10 |
| 113 | host: |
| 114 | name: gitlab.domain.com |
| 115 | port: 80 |
| 116 | |
| 117 | Gitlab server with user for basic auth |
| 118 | |
| 119 | .. code-block:: yaml |
| 120 | |
| 121 | nginx: |
| 122 | server: |
| 123 | enabled: true |
| 124 | user: |
| 125 | username1: |
| 126 | enabled: true |
| 127 | password: magicunicorn |
| 128 | htpasswd: htpasswd-site1 |
| 129 | username2: |
| 130 | enabled: true |
| 131 | password: magicunicorn |
| 132 | |
Ales Komarek | d77b797 | 2015-11-12 11:02:39 +0100 | [diff] [blame] | 133 | Proxy buffering |
| 134 | |
| 135 | .. code-block:: yaml |
| 136 | |
| 137 | nginx: |
| 138 | server: |
| 139 | enabled: true |
| 140 | bind: |
| 141 | address: '0.0.0.0' |
| 142 | ports: |
| 143 | - 80 |
| 144 | site: |
| 145 | gitlab_proxy: |
| 146 | enabled: true |
| 147 | type: proxy |
| 148 | proxy: |
| 149 | buffer: |
| 150 | number: 8 |
| 151 | size: 16 |
| 152 | host: |
| 153 | name: gitlab.domain.com |
| 154 | port: 80 |
| 155 | |
Michael KutĂ˝ | 3a5abf1 | 2015-12-04 21:03:33 +0100 | [diff] [blame] | 156 | Let's Encrypt |
| 157 | |
| 158 | .. code-block:: yaml |
| 159 | |
| 160 | nginx: |
| 161 | server: |
| 162 | enabled: true |
| 163 | bind: |
| 164 | address: '0.0.0.0' |
| 165 | ports: |
| 166 | - 443 |
| 167 | site: |
| 168 | gitlab_domain: |
| 169 | enabled: true |
| 170 | type: gitlab |
| 171 | name: domain |
| 172 | ssl: |
| 173 | enabled: true |
| 174 | engine: letsencrypt |
| 175 | host: |
| 176 | name: gitlab.domain.com |
| 177 | port: 443 |
| 178 | |
Adam Tengler | c391657 | 2016-01-25 17:46:52 +0100 | [diff] [blame] | 179 | Nginx stats server (required by collectd nginx plugin) |
| 180 | |
| 181 | .. code-block:: |
| 182 | |
| 183 | nginx: |
| 184 | server: |
| 185 | enabled: true |
| 186 | site: |
| 187 | nginx_stats_server: |
| 188 | enabled: true |
| 189 | type: nginx_stats |
| 190 | name: server |
| 191 | host: |
| 192 | name: 127.0.0.1 |
| 193 | port: 8888 |
| 194 | |
Filip Pytloun | 6b5bb65 | 2015-10-06 16:28:32 +0200 | [diff] [blame] | 195 | Read more |
| 196 | ========= |
| 197 | |
| 198 | * http://wiki.nginx.org/Main |
| 199 | * https://wiki.mozilla.org/Security/Server_Side_TLS#Modern_compatibility |
| 200 | * http://nginx.com/resources/admin-guide/reverse-proxy/ |
| 201 | * https://mozilla.github.io/server-side-tls/ssl-config-generator/ |