I have a NGINX server configured to work with node.js, but many times a file of 1.03MB of js is not loaded by various browser and various pc
Posted
by
Totty
on Server Fault
See other posts from Server Fault
or by Totty
Published on 2012-10-15T09:22:58Z
Indexed on
2012/10/15
9:39 UTC
Read the original article
Hit count: 242
I'm using this in a local LAN so it should be quite fast.
The nginx server use the node.js server to serve static files, so it must pass throught node.js to download the files, but that is not a problem when I'm not using the nginx.
In chrome with debugger on I can see that the status is: 206 - partial content and it only has downloaded 31KB of 1.03MB. After 1.1 min it turns red and the status failed. Waiting time: 6ms Receiving: 1.1 min
The headers in google chrom:
Request URL:http://192.168.1.16/production/assembly/script/production.js
Request Method:GET
Status Code:206 Partial Content
Request Headersview source
Accept:*/*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:pt-PT,pt;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Cookie:connect.sid=s%3Abls2qobcCaJ%2FyBNZwedtDR9N.0vD4Fi03H1bEdCszGsxIjjK0lZIjJhLnToWKFVxZOiE
Host:192.168.1.16
If-Range:"1081715-1350053827000"
Range:bytes=16090-16090
Referer:http://192.168.1.16/production/assembly/
User-Agent:Mozilla/5.0 (Windows NT 6.0) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4
Response Headersview source
Accept-Ranges:bytes
Cache-Control:public, max-age=0
Connection:keep-alive
Content-Length:1
Content-Range:bytes 16090-16090/1081715
Content-Type:application/javascript
Date:Mon, 15 Oct 2012 09:18:50 GMT
ETag:"1081715-1350053827000"
Last-Modified:Fri, 12 Oct 2012 14:57:07 GMT
Server:nginx/1.1.19
X-Powered-By:Express
My nginx configurations:
File 1:
user totty;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# 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 /home/totty/web/production01_server/node_modules/production/_logs/_NGINX_access.txt;
error_log /home/totty/web/production01_server/node_modules/production/_logs/_NGINX_error.txt;
##
# 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;
##
# 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
##
autoindex on;
include /home/totty/web/production01_server/_deployment/nginxConfigs/server/*;
}
File that is included by the previous file:
server {
# custom location for entry
# using only "/" instead of "/production/assembly" it
# would allow you to go to "thatip/". In this way
# we are limiting to "thatip/production/assembly/"
location /production/assembly/ {
# ip and port used in node.js
proxy_pass http://127.0.0.1:3000/;
}
location /production/assembly.mongo/ {
proxy_pass http://127.0.0.1:9000/;
proxy_redirect off;
}
location /production/assembly.logs/ {
autoindex on;
alias /home/totty/web/production01_server/node_modules/production/_logs/;
}
}
© Server Fault or respective owner