ПРОЕКТЫ 


  АРХИВ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  СТАТЬИ 


  ПЕРСОНАЛЬНОЕ 


  ПРОГРАММЫ 



ПИШИТЕ
ПИСЬМА












     АРХИВ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Возможно ли использовать nginx как туннель с кешированием статики и websockets



Забыл указать nginx 

nginx version: nginx/1.4.1
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) 
TLS SNI support enabled
configure arguments: 
--prefix=/etc/nginx 
--sbin-path=/usr/sbin/nginx 
--conf-path=/etc/nginx/nginx.conf 
--error-log-path=/var/log/nginx/error.log 
--http-log-path=/var/log/nginx/access.log 
--pid-path=/var/run/nginx.pid 
--lock-path=/var/run/nginx.lock 
--http-client-body-temp-path=/var/cache/nginx/client_temp 
--http-proxy-temp-path=/var/cache/nginx/proxy_temp 
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp 
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp 
--http-scgi-temp-path=/var/cache/nginx/scgi_temp 
--user=nginx 
--group=nginx 
--with-http_ssl_module 
--with-http_realip_module 
--with-http_addition_module 
--with-http_sub_module 
--with-http_gunzip_module 
--with-http_gzip_static_module 
--with-http_secure_link_module 
--with-http_stub_status_module 
--with-mail 
--with-mail_ssl_module 
--with-file-aio 
--with-ipv6 
--with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector 
--param=ssp-buffer-size=4 -m64 -mtune=generic' 
--add-module=/home/builder/rpmbuild/SOURCES/ngx_devel_kit 
--add-module=/home/builder/rpmbuild/SOURCES/redis2-nginx-module 
--add-module=/home/builder/rpmbuild/SOURCES/set-misc-nginx-module 
--add-module=/home/builder/rpmbuild/SOURCES/lua-nginx-module 
--add-module=/home/builder/rpmbuild/SOURCES/echo-nginx-module 
--add-module=/home/builder/rpmbuild/SOURCES/nginx-rtmp-module


tao Wrote:
-------------------------------------------------------
> в браузере-клиенте (chrome) прописан ip http proxy (nginx) 
> на домене club по 3000 порту висит socket.io с поддержкой xhr-pooling
> и websockets и nginx для отдачи статики по 80 порту
> все хорошо и отлично кешируется c 80 порта, xhr-pooling  тоже работает
> отлично
> 
> Но как только переключаюсь на websockets  , получаю в логи
> ==
> [ 03/Jul/2013:11:50:17 +0400 ] -  "CONNECT club:3000 HTTP/1.1" "400"
> "rt:0.018" "urt:-" "cache: -" 
> 
> 
> 
> ==== CONFIG
> map $http_upgrade $connection_upgrade {
>         default upgrade;
>         ''      close;
> }
> 
> upstream club_80        {    server club:80;}
> upstream club_3000      {    server club:3000;}
> 
> server {
> 
>     listen 8090;
>     server_name _;
>     access_log /var/log/nginx/proxy.8090.access.log common;
>     error_log  /var/log/nginx/proxy.8090.error.log;
> 
>     source_charset utf-8;
>     charset        utf-8;
> 
>     recursive_error_pages on;
> 
>     #upstream mapping
>     set $xport 80;
>     if ($http_host ~ ":(\d+)") { set $xport $1; }
>     set $upstr "club_${xport}";
> 
> 
>     error_page 417 = @cached;
>     error_page 418 = @nocached;
>     
>     proxy_http_version 1.1;
>     proxy_set_header        Upgrade         $http_upgrade;
>     proxy_set_header        Connection      $connection_upgrade;
> 
>     proxy_buffering off;
>     
>     location / {
> 
>         return 417;
>     }
>    location /socket.io {
>         
>         return 418;
>     }
>     
>     location ~ /(ru|en/)?index.html {
> 
>         return 418;
>     }
>             
>     #for index/socket.io
>     location @nocached {
>         proxy_read_timeout 86400;
>         proxy_cache     off;
>         proxy_pass      http://$upstr;
>         proxy_set_header        Host            $host;
>         proxy_set_header        X-Forwarded-For
> $proxy_add_x_forwarded_for;
>         add_header              Cache-Control  
> "no-cache,no-store,must-revalidate";
>         expires -1;
>     }
>         
>     #for static
>     location @cached {
>     
>         proxy_cache_methods GET;
>         proxy_cache_valid 200 5d;
>         proxy_cache clubcache;
>         proxy_pass      http://$upstr;
>         proxy_set_header        Host            $host:$proxy_port;
>         proxy_set_header        X-Forwarded-For
> $proxy_add_x_forwarded_for;
> 
>         proxy_cache_bypass      $cookie_nocache
> $arg_nocache$arg_comment;
>         proxy_cache_bypass      $http_pragma    $http_authorization;
> 
>         proxy_ignore_headers    X-Accel-Expires Expires Cache-Control
> Set-Cookie;
> 
>         add_header Cache-Control "no-cache,no-store,must-revalidate";
>         expires -1;
> 
>     }
> }
> ================= END

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?21,240532,240533#msg-240533

_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.