ecaiyanlinux | 6cad5d9 | 2022-01-12 12:10:04 +0100 | [diff] [blame] | 1 | # user www-data; |
ecaiyanlinux | 9ab67f5 | 2020-05-14 15:11:45 +0200 | [diff] [blame] | 2 | worker_processes auto; |
| 3 | pid /run/nginx.pid; |
| 4 | include /etc/nginx/modules-enabled/*.conf; |
| 5 | |
RehanRaza | d728781 | 2020-05-29 17:46:40 +0200 | [diff] [blame] | 6 | env ALLOW_HTTP; |
| 7 | |
ecaiyanlinux | 9ab67f5 | 2020-05-14 15:11:45 +0200 | [diff] [blame] | 8 | events { |
| 9 | worker_connections 768; |
| 10 | # multi_accept on; |
| 11 | } |
| 12 | |
| 13 | http { |
| 14 | |
| 15 | ## |
| 16 | # Basic Settings |
| 17 | ## |
| 18 | |
| 19 | sendfile on; |
| 20 | tcp_nopush on; |
| 21 | tcp_nodelay on; |
| 22 | keepalive_timeout 65; |
| 23 | types_hash_max_size 2048; |
| 24 | # server_tokens off; |
| 25 | |
| 26 | # server_names_hash_bucket_size 64; |
| 27 | # server_name_in_redirect off; |
| 28 | |
| 29 | include /etc/nginx/mime.types; |
| 30 | default_type application/octet-stream; |
| 31 | |
RehanRaza | d728781 | 2020-05-29 17:46:40 +0200 | [diff] [blame] | 32 | perl_set $allow_http 'sub { return $ENV{"ALLOW_HTTP"}; }'; |
| 33 | |
ecaiyanlinux | 9ab67f5 | 2020-05-14 15:11:45 +0200 | [diff] [blame] | 34 | server { # simple reverse-proxy |
RehanRaza | d728781 | 2020-05-29 17:46:40 +0200 | [diff] [blame] | 35 | listen 8085; |
ecaiyanlinux | 9ab67f5 | 2020-05-14 15:11:45 +0200 | [diff] [blame] | 36 | listen [::]:8085; |
RehanRaza | d728781 | 2020-05-29 17:46:40 +0200 | [diff] [blame] | 37 | server_name localhost; |
| 38 | if ($allow_http != true) { |
| 39 | return 444; |
| 40 | } |
| 41 | |
| 42 | # serve dynamic requests |
| 43 | location / { |
| 44 | proxy_set_header Host $host; |
| 45 | proxy_set_header X-Real-IP $remote_addr; |
| 46 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 47 | proxy_pass http://localhost:2222; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | server { # simple reverse-proxy |
ecaiyanlinux | 9ab67f5 | 2020-05-14 15:11:45 +0200 | [diff] [blame] | 52 | listen 8185 ssl; |
| 53 | listen [::]:8185 ssl; |
| 54 | server_name localhost; |
| 55 | ssl_certificate /usr/src/app/cert/cert.crt; |
| 56 | ssl_certificate_key /usr/src/app/cert/key.crt; |
| 57 | ssl_password_file /usr/src/app/cert/pass; |
| 58 | |
| 59 | # serve dynamic requests |
| 60 | location / { |
ecaiyanlinux | dceaf39 | 2020-05-18 14:40:53 +0200 | [diff] [blame] | 61 | proxy_set_header Host $host; |
| 62 | proxy_set_header X-Real-IP $remote_addr; |
| 63 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 64 | proxy_pass http://localhost:2222; |
ecaiyanlinux | 9ab67f5 | 2020-05-14 15:11:45 +0200 | [diff] [blame] | 65 | } |
| 66 | } |
| 67 | ## |
| 68 | # SSL Settings |
| 69 | ## |
| 70 | |
| 71 | ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE |
| 72 | ssl_prefer_server_ciphers on; |
| 73 | |
| 74 | ## |
| 75 | # Logging Settings |
| 76 | ## |
| 77 | |
| 78 | access_log /var/log/nginx/access.log; |
| 79 | error_log /var/log/nginx/error.log; |
| 80 | |
| 81 | ## |
| 82 | # Gzip Settings |
| 83 | ## |
| 84 | |
| 85 | gzip on; |
| 86 | |
| 87 | # gzip_vary on; |
| 88 | # gzip_proxied any; |
| 89 | # gzip_comp_level 6; |
| 90 | # gzip_buffers 16 8k; |
| 91 | # gzip_http_version 1.1; |
| 92 | # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; |
ecaiyanlinux | 3f519ca | 2022-02-21 12:31:15 +0100 | [diff] [blame^] | 93 | } |