The original post: /r/nginx by /u/Brief-Effective162 on 2024-06-30 20:01:13.
Ih guys. I will try to go straightforward to the problem to avoid a very big text.
I have 4 tomcats at same host. They share a backend apps in tomcat1. tomcat 2,3 and 4 are using their frontend app.
It was using an obsolete webtier 11g and was working fine.
But I need to change it to nginx docker container for better security and performance. It was done and application is working beside some randomic freezind at front-end`s users side.
Ok. I will put a block of tomcat server as an example. All servers are using same config. Please check my configs here:
<Connector port="8286" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
maxThreads="300"
minSpareThreads="50"
maxSpareThreads="100"
enableLookups="false"
acceptCount="200"
maxConnections="2000"
/>
Here is my nginx.conf:
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
#erro config 403
#error_page 403 /e403.html;
# location =/e403.html {
# root html;
# allow all;
#}
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
# Allow larger than normal headers
large_client_header_buffers 4 128k;
client_max_body_size 100M;
log_format main '$remote_addr - $remote_user [$time_local] "$host" - "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" '
'$proxy_host $upstream_addr';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_proxied any;
gzip_buffers 16 8k;
gzip_comp_level 6;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_vary on;
include /etc/nginx/conf.d/*.conf;
}
Here is an example of my location block:
location /main/ {
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-Proto $scheme;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_store off;
proxy_buffering on;
proxy_buffer_size 16k;
proxy_buffers 64 16k;
proxy_busy_buffers_size 32k;
proxy_connect_timeout 3s;
proxy_send_timeout 20s;
proxy_read_timeout 20s;
send_timeout 20s;
proxy_pass http://w.x.y.z:8286;
}
This proxy has a forward rule in my firewall.
All things can comunicate well with each other. The problem are sometimes I got a random freezing at user side.
This is very tricky to got this problem because I am not getting any logs indicating errors to find a root cause.
This is java application running angular front-end and oracle database as db backend.
I would like to get some advice about my configs.
Can compressing get some issue?
Those timeouts are well combined?
Those buffers are ok?
How to match those timeouts? Can it lead to problems?
What could be the problem based in my configuration?
Does it have a miss configuration leading to get lost packets or too fast response?
Could you see if it has some issues?
Any advice is wellcomed.
PS - I am monitoring my network and latency is quite well and I am not getting lost packets and retransmissions.