|
| 1 | +server { |
| 2 | + listen ${NGINX_PORT}; |
| 3 | + server_name localhost; |
| 4 | + |
| 5 | + root ${NGINX_WEB_ROOT}; |
| 6 | + |
| 7 | + client_max_body_size ${NGINX_MAX_BODY_SIZE}; |
| 8 | + |
| 9 | + set_real_ip_from 172.16.0.0/16; |
| 10 | + set_real_ip_from 192.168.39.0/24; |
| 11 | + real_ip_recursive on; |
| 12 | + real_ip_header X-Forwarded-For; |
| 13 | + |
| 14 | + location = /cron-metrics { |
| 15 | + # Proxy to supercronic metrics |
| 16 | + proxy_pass http://${NGINX_CRON_METRICS}/metrics; |
| 17 | + proxy_set_header Host $host; |
| 18 | + proxy_set_header X-Real-IP $remote_addr; |
| 19 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| 20 | + proxy_set_header X-Forwarded-Proto $scheme; |
| 21 | + } |
| 22 | + |
| 23 | + location / { |
| 24 | + # try to serve file directly, fallback to index.php |
| 25 | + try_files $uri /index.php$is_args$args; |
| 26 | + } |
| 27 | + |
| 28 | + # Protect files and directories from prying eyes. |
| 29 | + location ~* \.(engine|inc|install|make|module|profile|po|sh|.*sql|.tar|.gz|.bz2|theme|twig|tpl(\.php)?|xtmpl|yml)(~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\.(?!well-known).*|Entries.*|Repository|Root|Tag|Template|composer\.(json|lock)|web\.config)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig|\.save)$ { |
| 30 | + deny all; |
| 31 | + return 404; |
| 32 | + } |
| 33 | + |
| 34 | + location ~ ^/index\.php(/|$) { |
| 35 | + fastcgi_buffers 16 32k; |
| 36 | + fastcgi_buffer_size 64k; |
| 37 | + fastcgi_busy_buffers_size 64k; |
| 38 | + |
| 39 | + fastcgi_pass ${NGINX_FPM_SERVICE}; |
| 40 | + fastcgi_split_path_info ^(.+\.php)(/.*)$; |
| 41 | + include fastcgi_params; |
| 42 | + |
| 43 | + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; |
| 44 | + fastcgi_param DOCUMENT_ROOT $realpath_root; |
| 45 | + |
| 46 | + internal; |
| 47 | + } |
| 48 | + |
| 49 | + location ~ \.php$ { |
| 50 | + return 404; |
| 51 | + } |
| 52 | + |
| 53 | + # Send log message to files symlinked to stdout/stderr. |
| 54 | + error_log /dev/stderr; |
| 55 | + access_log /dev/stdout main; |
| 56 | +} |
0 commit comments