Skip to content

Commit

Permalink
fix excessive logging in nginx config
Browse files Browse the repository at this point in the history
  • Loading branch information
KW-M committed Dec 6, 2024
1 parent 8ca7df2 commit f04de64
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1 +1 @@
echo "run pre_push first: pnpm run pre_push" && exit 1
echo "run pre_push first: pnpm run pre_push && git push --no-verify" && exit 1
34 changes: 19 additions & 15 deletions rov-tooling/config-files/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

# user pi;
worker_processes auto;
worker_processes 1;

error_log /var/log/nginx/error.log notice;
pid /tmp/nginx.pid;

events {
worker_connections 768;
worker_connections 200;
}

http {
Expand All @@ -18,9 +18,9 @@ http {
scgi_temp_path /tmp/scgi_temp;

# setup logging:
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
log_format main '[$time_local] $server_addr:$server_port -> $remote_addr:$remote_port'
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" ';
access_log /var/log/nginx/access.log main;

# common defaults:
Expand Down Expand Up @@ -54,11 +54,21 @@ http {
location / {
root /usr/share/nginx/html/frontend/;
index index.html index.htm;

# # kill cache (reduces CPU & memory usage)
# expires -1;
# #TODO: add more cache control headers https://serverfault.com/questions/1067735/stop-nginx-from-locally-caching-a-directory
# add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
}

location /internal {
root /usr/share/nginx/html/;
index index.html index.htm;

# # kill cache (reduces CPU & memory usage)
# expires -1;
# #TODO: add more cache control headers https://serverfault.com/questions/1067735/stop-nginx-from-locally-caching-a-directory
# add_header Cache-Control "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
}

location /all {
Expand Down Expand Up @@ -139,12 +149,15 @@ http {
}
}


# expose chromium dev tools port
server {
listen 9224; # port for ipv4
listen [::]:9224; # port for ipv6
# server_name localhost;

large_client_header_buffers 4 32k;

location / {
proxy_pass http://127.0.0.1:9224/;
proxy_redirect off;
Expand All @@ -155,19 +168,10 @@ http {

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # seems to cause problems, will recursively add IPs to the access log
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;

# proxy_buffer_size 4k;
# proxy_buffers 4 32k;
# proxy_busy_buffers_size 64k;
# proxy_temp_file_write_size 64k;

# client_max_body_size 10m;
# client_body_buffer_size 128k;
}
}

Expand Down

0 comments on commit f04de64

Please sign in to comment.