add nginx.conf logging option
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled

This commit is contained in:
2025-04-23 10:13:42 +01:00
parent 6dbcb88857
commit a947004e54
2 changed files with 69 additions and 2 deletions
+43
View File
@@ -0,0 +1,43 @@
apiVersion: v1
data:
nginx.conf: "worker_processes 1;\nevents { worker_connections 1024; }\n\nhttp {\n\n\tsendfile
on;\n\tclient_max_body_size 1500M; \n\tserver_names_hash_bucket_size 1024;\n proxy_http_version
\ 1.1;\n proxy_set_header X-Forwarded-Scheme $scheme;\n
\ proxy_set_header Accept-Encoding \"\";\n\tproxy_set_header
\ Host $host;\n\tproxy_set_header X-Real-IP $remote_addr;\n\tproxy_set_header
\ X-Forwarded-For $proxy_add_x_forwarded_for;\n\tproxy_set_header X-Forwarded-Host
$server_name;\n\t#proxy_set_header Upgrade $http_upgrade;\n\t#proxy_set_header
Connection 'upgrade';\n\t#proxy_cache_bypass $http_upgrade; \n\n\tgzip on;\n\tgzip_types
text/plain application/xml application/json image/svg+xml text/css;\n\tgzip_min_length
1000;\n \n\tlog_format my_custom_format '$http_host $remote_addr - $remote_user
[$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\"';\n\n\n\tserver
{\n\tlisten 80;\n listen 443 default ssl;\n\tssl_certificate /etc/nginx/ssl/live/default.tryton.geeraert.eu/fullchain.pem;
# managed by$\n ssl_certificate_key /etc/nginx/ssl/live/default.tryton.geeraert.eu/privkey.pem;
# managed $\n location / {\n proxy_pass http://1.1.1.1;\n
\ proxy_redirect off;\n proxy_set_header Host $host;\n
\ proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header
\ X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_set_header X-Forwarded-Host
$server_name;\n\t\t}\n\t}\n\t# Connection header for WebSocket reverse proxy\n\tmap
$http_upgrade $connection_upgrade {\n\t\tdefault upgrade;\n '' close;\n\t}\n\n\tinclude
/etc/nginx/conf.d/*.conf;\n\tresolver 127.0.0.1 ipv6=off valid=40s; # The DNS
IP server\n\t\n\t#https://www.tweaked.io/guide/nginx-proxying/\n\tproxy_cache_path
/tmp/cache levels=1:2 keys_zone=cache:60m max_size=1G;\n\n#\tlog_format main '$remote_addr
- $remote_user [$time_local] '\n# '\"$request\" $status
$body_bytes_sent '\n# '\"$http_referer\" \"$http_user_agent\"
\"$gzip_ratio\"'\n# 'host - $host '\n# '$scheme
$proxy_add_x_forwarded_for '\n# '$remote_addr [$time_local]'\n#
\ '\"$request\" $status $body_bytes_sent '\n# '\"$http_referer\"
\"$http_user_agent\"'\n# '\"$request\" $status $body_bytes_sent
'\n# '\"$http_referer\" \"$http_user_agent\" \"$gzip_ratio\"';\n\n#
\ log_format upstream_time '$remote_addr - $remote_user [$time_local] '\n# '\"$request\"
$status $body_bytes_sent '\n# '\"$http_referer\" \"$http_user_agent\"'\n#
\ 'host + $host '\n# '$scheme
$proxy_add_x_forwarded_for '\n# '$remote_addr [$time_local]'\n#
\ '\"$request\" $status $body_bytes_sent '\n# '\"$http_referer\"
\"$http_user_agent\"'\n# 'rt=$request_time uct=\"$upstream_connect_time\"
uht=\"$upstream_header_time\" urt=\"$upstream_response_time\"';\n\n\n}\n\n\n"
kind: ConfigMap
metadata:
creationTimestamp: null
name: nginx-config
namespace: reverse-proxy
+26 -2
View File
@@ -4,7 +4,7 @@ events { worker_connections 1024; }
http { http {
sendfile on; sendfile on;
client_max_body_size 500M; client_max_body_size 1500M;
server_names_hash_bucket_size 1024; server_names_hash_bucket_size 1024;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header X-Forwarded-Scheme $scheme; proxy_set_header X-Forwarded-Scheme $scheme;
@@ -21,6 +21,8 @@ http {
gzip_types text/plain application/xml application/json image/svg+xml text/css; gzip_types text/plain application/xml application/json image/svg+xml text/css;
gzip_min_length 1000; gzip_min_length 1000;
log_format my_custom_format '$http_host $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
server { server {
listen 80; listen 80;
@@ -40,7 +42,7 @@ http {
map $http_upgrade $connection_upgrade { map $http_upgrade $connection_upgrade {
default upgrade; default upgrade;
'' close; '' close;
} }
include /etc/nginx/conf.d/*.conf; include /etc/nginx/conf.d/*.conf;
resolver 127.0.0.1 ipv6=off valid=40s; # The DNS IP server resolver 127.0.0.1 ipv6=off valid=40s; # The DNS IP server
@@ -48,6 +50,28 @@ http {
#https://www.tweaked.io/guide/nginx-proxying/ #https://www.tweaked.io/guide/nginx-proxying/
proxy_cache_path /tmp/cache levels=1:2 keys_zone=cache:60m max_size=1G; proxy_cache_path /tmp/cache levels=1:2 keys_zone=cache:60m max_size=1G;
# log_format main '$remote_addr - $remote_user [$time_local] '
# '"$request" $status $body_bytes_sent '
# '"$http_referer" "$http_user_agent" "$gzip_ratio"'
# 'host - $host '
# '$scheme $proxy_add_x_forwarded_for '
# '$remote_addr [$time_local]'
# '"$request" $status $body_bytes_sent '
# '"$http_referer" "$http_user_agent"'
# '"$request" $status $body_bytes_sent '
# '"$http_referer" "$http_user_agent" "$gzip_ratio"';
# log_format upstream_time '$remote_addr - $remote_user [$time_local] '
# '"$request" $status $body_bytes_sent '
# '"$http_referer" "$http_user_agent"'
# 'host + $host '
# '$scheme $proxy_add_x_forwarded_for '
# '$remote_addr [$time_local]'
# '"$request" $status $body_bytes_sent '
# '"$http_referer" "$http_user_agent"'
# 'rt=$request_time uct="$upstream_connect_time" uht="$upstream_header_time" urt="$upstream_response_time"';
} }