第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

nginx反向代理到本機(jī)nodejs應(yīng)用時(shí)速度很慢

nginx反向代理到本機(jī)nodejs應(yīng)用時(shí)速度很慢

富國(guó)滬深 2019-03-29 22:11:14
我用nodejs搭了一個(gè)網(wǎng)站,但是同網(wǎng)的其他的機(jī)器無(wú)法訪問(wèn),我上網(wǎng)查,有人說(shuō)需要一個(gè)web服務(wù)器發(fā)布出來(lái),所以我本機(jī)又搭了nginx進(jìn)行反向代理到我nodejs上,但是很慢。每次第一次訪問(wèn)都得等好長(zhǎng)時(shí)間。但是直接訪問(wèn)nodejs的端口就很快。項(xiàng)目很小,不應(yīng)該,所以我感覺是反向代理哪里設(shè)置的不對(duì)。求解?#usernobody;worker_processes2;#error_loglogs/error.log;#error_loglogs/error.lognotice;error_loglogs/error.loginfo;#pidlogs/nginx.pid;events{worker_connections65535;}http{includemime.types;default_typeapplication/octet-stream;server_names_hash_bucket_size128;#增加client_header_buffer_size32k;#增加large_client_header_buffers432k;#增加client_max_body_size300m;#增加tcp_nopushon;#修改為onkeepalive_timeout60;#修改為60tcp_nodelayon;#增加server_tokensoff;#增加,不顯示nginx版本信息gzipon;#修改為ongzip_min_length1k;#增加gzip_buffers416k;#增加gzip_http_version1.1;#增加gzip_comp_level2;#增加gzip_typestext/plainapplication/x-javascripttext/cssapplication/xml;#增加gzip_varyon;#增加#log_formatmain'$remote_addr-$remote_user[$time_local]"$request"'#'$status$body_bytes_sent"$http_referer"'#'"$http_user_agent""$http_x_forwarded_for"';#access_loglogs/access.logmain;sendfileon;#tcp_nopushon;#keepalive_timeout0;#keepalive_timeout65;#gzipon;map$http_upgrade$connection_upgrade{defaultupgrade;''close;}server{listen9080;server_namelocalhost;#charsetkoi8-r;#access_loglogs/host.access.logmain;#location/{#roothtml;#indexindex.htmlindex.htm;#}location/{proxy_passhttp://localhost:8080;#nodejsproxy_set_headerX-Real-IP$remote_addr;proxy_set_headerHost$host;proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;proxy_http_version1.1;proxy_set_headerUpgrade$http_upgrade;proxy_set_headerConnection"upgrade";#timeoutsettingsproxy_connect_timeout159s;proxy_send_timeout600;proxy_read_timeout600;proxy_buffer_size64k;proxy_buffers1632k;proxy_busy_buffers_size64k;proxy_temp_file_write_size64k;proxy_pass_headerSet-Cookie;proxy_redirectoff;proxy_hide_headerVary;proxy_set_headerAccept-Encoding'';proxy_ignore_headersCache-ControlExpires;proxy_set_headerReferer$http_referer;proxy_set_headerHost$host;proxy_set_headerCookie$http_cookie;proxy_set_headerX-Real-IP$remote_addr;proxy_set_headerX-Forwarded-Host$host;proxy_set_headerX-Forwarded-Server$host;proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;}#error_page404/404.html;#redirectservererrorpagestothestaticpage/50x.html#error_page500502503504/50x.html;location=/50x.html{roothtml;}#proxythePHPscriptstoApachelisteningon127.0.0.1:80##location~\.php${#proxy_passhttp://127.0.0.1;#}#passthePHPscriptstoFastCGIserverlisteningon127.0.0.1:9000##location~\.php${#roothtml;#fastcgi_pass127.0.0.1:9000;#fastcgi_indexindex.php;#fastcgi_paramSCRIPT_FILENAME/scripts$fastcgi_script_name;#includefastcgi_params;#}#denyaccessto.htaccessfiles,ifApache'sdocumentroot#concurswithnginx'sone##location~/\.ht{#denyall;#}}#anothervirtualhostusingmixofIP-,name-,andport-basedconfiguration##server{#listen8000;#listensomename:8080;#server_namesomenamealiasanother.alias;#location/{#roothtml;#indexindex.htmlindex.htm;#}#}#HTTPSserver##server{#listen443;#server_namelocalhost;#sslon;#ssl_certificatecert.pem;#ssl_certificate_keycert.key;#ssl_session_timeout5m;#ssl_protocolsSSLv2SSLv3TLSv1;#ssl_ciphersHIGH:!aNULL:!MD5;#ssl_prefer_server_cipherson;#location/{#roothtml;#indexindex.htmlindex.htm;#}#}}
查看完整描述

2 回答

?
慕萊塢森

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個(gè)贊

你用nginx設(shè)置了這么多HTTPheader做什么?
只需要這三個(gè),其他的刪掉:
proxy_set_headerX-Real-IP$remote_addr;
proxy_set_headerHost$host;
proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
把這一段也刪掉:
map$http_upgrade$connection_upgrade{
defaultupgrade;
''close;
}
很可能是你設(shè)了upgrade的header造成的問(wèn)題。
                            
查看完整回答
反對(duì) 回復(fù) 2019-03-29
?
Qyouu

TA貢獻(xiàn)1786條經(jīng)驗(yàn) 獲得超11個(gè)贊

在server下增加下面的配置項(xiàng),看看是否有效果
ip_hash;
                            
查看完整回答
反對(duì) 回復(fù) 2019-03-29
  • 2 回答
  • 0 關(guān)注
  • 612 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)