BjornMagnussonXA | e3883d0 | 2023-04-11 14:16:52 +0200 | [diff] [blame] | 1 | # ============LICENSE_START=============================================== |
| 2 | # Copyright (C) 2023 Nordix Foundation. All rights reserved. |
| 3 | # ======================================================================== |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # ============LICENSE_END================================================= |
| 16 | # |
| 17 | |
ecaiyanlinux | 9ab67f5 | 2020-05-14 15:11:45 +0200 | [diff] [blame] | 18 | worker_processes auto; |
| 19 | pid /run/nginx.pid; |
| 20 | include /etc/nginx/modules-enabled/*.conf; |
BjornMagnussonXA | e3883d0 | 2023-04-11 14:16:52 +0200 | [diff] [blame] | 21 | load_module /usr/lib/nginx/modules/ndk_http_module.so; |
| 22 | load_module /usr/lib/nginx/modules/ngx_http_lua_module.so; |
ecaiyanlinux | 9ab67f5 | 2020-05-14 15:11:45 +0200 | [diff] [blame] | 23 | |
RehanRaza | d728781 | 2020-05-29 17:46:40 +0200 | [diff] [blame] | 24 | env ALLOW_HTTP; |
| 25 | |
ecaiyanlinux | 9ab67f5 | 2020-05-14 15:11:45 +0200 | [diff] [blame] | 26 | events { |
| 27 | worker_connections 768; |
ecaiyanlinux | 9ab67f5 | 2020-05-14 15:11:45 +0200 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | http { |
| 31 | |
| 32 | ## |
| 33 | # Basic Settings |
| 34 | ## |
| 35 | |
| 36 | sendfile on; |
| 37 | tcp_nopush on; |
| 38 | tcp_nodelay on; |
| 39 | keepalive_timeout 65; |
| 40 | types_hash_max_size 2048; |
ecaiyanlinux | 9ab67f5 | 2020-05-14 15:11:45 +0200 | [diff] [blame] | 41 | |
| 42 | include /etc/nginx/mime.types; |
| 43 | default_type application/octet-stream; |
| 44 | |
BjornMagnussonXA | e3883d0 | 2023-04-11 14:16:52 +0200 | [diff] [blame] | 45 | |
RehanRaza | d728781 | 2020-05-29 17:46:40 +0200 | [diff] [blame] | 46 | |
ecaiyanlinux | 9ab67f5 | 2020-05-14 15:11:45 +0200 | [diff] [blame] | 47 | server { # simple reverse-proxy |
BjornMagnussonXA | e3883d0 | 2023-04-11 14:16:52 +0200 | [diff] [blame] | 48 | set_by_lua $allow_http 'return os.getenv("ALLOW_HTTP")'; |
| 49 | listen 8085; |
ecaiyanlinux | 9ab67f5 | 2020-05-14 15:11:45 +0200 | [diff] [blame] | 50 | listen [::]:8085; |
RehanRaza | d728781 | 2020-05-29 17:46:40 +0200 | [diff] [blame] | 51 | server_name localhost; |
BjornMagnussonXA | e3883d0 | 2023-04-11 14:16:52 +0200 | [diff] [blame] | 52 | if ($allow_http != true) { |
| 53 | return 444; |
| 54 | } |
RehanRaza | d728781 | 2020-05-29 17:46:40 +0200 | [diff] [blame] | 55 | |
| 56 | # serve dynamic requests |
| 57 | location / { |
| 58 | proxy_set_header Host $host; |
| 59 | proxy_set_header X-Real-IP $remote_addr; |
| 60 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 61 | proxy_pass http://localhost:2222; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | server { # simple reverse-proxy |
ecaiyanlinux | 9ab67f5 | 2020-05-14 15:11:45 +0200 | [diff] [blame] | 66 | listen 8185 ssl; |
| 67 | listen [::]:8185 ssl; |
| 68 | server_name localhost; |
| 69 | ssl_certificate /usr/src/app/cert/cert.crt; |
| 70 | ssl_certificate_key /usr/src/app/cert/key.crt; |
| 71 | ssl_password_file /usr/src/app/cert/pass; |
| 72 | |
| 73 | # serve dynamic requests |
| 74 | location / { |
ecaiyanlinux | dceaf39 | 2020-05-18 14:40:53 +0200 | [diff] [blame] | 75 | proxy_set_header Host $host; |
| 76 | proxy_set_header X-Real-IP $remote_addr; |
| 77 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 78 | proxy_pass http://localhost:2222; |
ecaiyanlinux | 9ab67f5 | 2020-05-14 15:11:45 +0200 | [diff] [blame] | 79 | } |
| 80 | } |
| 81 | ## |
| 82 | # SSL Settings |
| 83 | ## |
| 84 | |
| 85 | ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE |
| 86 | ssl_prefer_server_ciphers on; |
| 87 | |
| 88 | ## |
| 89 | # Logging Settings |
| 90 | ## |
| 91 | |
| 92 | access_log /var/log/nginx/access.log; |
| 93 | error_log /var/log/nginx/error.log; |
| 94 | |
| 95 | ## |
| 96 | # Gzip Settings |
| 97 | ## |
| 98 | |
| 99 | gzip on; |
| 100 | |
BjornMagnussonXA | e3883d0 | 2023-04-11 14:16:52 +0200 | [diff] [blame] | 101 | } |