I have a a nginx server deployed in GoDaddy XLarge Cloud Server with 8GB RAM and 4 CPU. My setup for nginx is to proxy request to a Google App Engine application.
The problem is the nginx serves the static files too slow, sometimes breaking the connection rendering the website full or broken images, CSS and JS files. Now accessing the GAE app directly the static files are served really quick.
Here is my server nginx.conf file:
user www-data;
worker_processes 1;
worker_rlimit_nofile 20480; # worker_connections * 4
pid /run/nginx.pid;
events {
use epoll;
worker_connections 4096;
multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
client_body_timeout 12;
client_header_timeout 12;
keepalive_timeout 15;
send_timeout 10;
types_hash_max_size 2048;
# server_tokens off;
##
# Tweaks
# https://www.digitalocean.com/community/tutorials/how-to-optimize-nginx-configuration
##
client_body_buffer_size 10K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 2 1k;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
## Proxy Settings
##
proxy_buffering off;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Update
Here the Network graph for the application server:
Here the Network graph for the NGINX server (very slow):
- What could be causing the slowness of nginx in this configuration?
- Is this because GoDaddy Cloud Servers are slow? or something is really wrong with the NGINX configuration?
- What configuration can make the proxy work fast?