Forum: NGINX nginx reports when used with varnish

3f3ac66afcf2830905f13da6c93adb5e?d=identicon&s=25 Joydeep Bakshi (Guest)
on 2014-04-22 09:25
(Received via mailing list)
Hello all,

My setting works well  through nginx->apache but not through
nginx->varnish->apache

apache is configured to listen to port 8080 . when nginx uses

proxy_pass http://127.0.0.1:8080

the sites are running fine.

If I introduce varnish after nginx  by  [proxy_pass
http://127.0.0.1:6082]
 the nginx starts throwing following error and browser also shows "*Zero
Sized Reply"*


[error] 17147#0: *207 upstream sent no valid HTTP/1.0 header while
reading
response header from upstream

and /var/log/messages shows

varnishd[16984]: CLI telnet 127.0.0.1 42212 127.0.0.1 6082 Wr 101
Unknown
request.#012Type 'help' for more info.#012all commands are in
lower-case.

varnishd[16984]: CLI telnet 127.0.0.1 42212 127.0.0.1 6082 Rd
Cache-Control: max-age=0

obviously varnish is configured to listen to apache

backend default {
        .host = "127.0.0.1";
        .port = "8080";
}

Can anyone please suggest the possible reason which is causing the
problem ?
63f341734581b167c7b698169bdd2510?d=identicon&s=25 Lukas Tribus (Guest)
on 2014-04-22 10:10
(Received via mailing list)
>
> varnishd[16984]: CLI telnet 127.0.0.1 42212 127.0.0.1 6082 Wr 101
> Unknown request.#012Type 'help' for more info.#012all commands are in
> lower-case.
>
> varnishd[16984]: CLI telnet 127.0.0.1 42212 127.0.0.1 6082 Rd
> Cache-Control: max-age=0

Can you capture the tcp 6082 traffic and post the entire HTTP
conversation?



Lukas
3f3ac66afcf2830905f13da6c93adb5e?d=identicon&s=25 Joydeep Bakshi (Guest)
on 2014-04-22 10:46
(Received via mailing list)
Hello Lukas,

I have just checked and found nothing

# tcpdump  -vv port 6082
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size
65535
bytes
63f341734581b167c7b698169bdd2510?d=identicon&s=25 Lukas Tribus (Guest)
on 2014-04-22 10:56
(Received via mailing list)
> Hello Lukas,
>
> I have just checked and found nothing
>
> # tcpdump -vv port 6082
> tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size
> 65535 bytes

Fix your capture.

- capture the traffic on loopback, not eth0
- don't truncate packets (-s 0)
- write in a cap file, tcpdump output is not very helpful


$ tcpdump -i lo -s0 -w tcp6082-traffic.cap port 6082



Lukas
3f3ac66afcf2830905f13da6c93adb5e?d=identicon&s=25 Joydeep Bakshi (Guest)
on 2014-04-22 11:04
(Received via mailing list)
Thanks Lukas,

here are the O/P

324241^B^@^D^@^@^@^@^@^@^@^@^@377377^@^@^A^@^@^@N/VS}D^K^@B^@^@^@B^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@4212277@
^@@^F262^B^?^@^@^A^?^@^@^A
244377^W302^\241262N^@^@^@^@200252376(^@^@^B^D377327^A^A^D^B^A^C^C^GN/VS221D^K^@B^@^@^@B^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@4^@^@@^@@^F<302^?^@^@^A^?^@^@^A^W377:200/R^\241262O200R252252376(^@^@^B^D377327^A^A^D^B^A^C^C^GN/VS240D^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212300@
^@@^F262^M^?^@^@^A^?^@^@^A244377^W302^\241262O:200/SP^P^AV376^\^@^@N/VS317D^K^@230^C^@^@230^C^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^C
212212301@^@@^F256250^?^@^@^A^?^@^@^A244377^W302^\241262O:200/SP^X^AV^A^?^@^@GET
/ HTTP/1.0
Host: dustri.bookopt.de
X-Real-IP: 198.168.1.4
X-Forwarded-For: 198.168.1.4
X-Server-Address: 198.168.1.2
Connection: closeUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X
10.9;
rv:27.0) Gecko/20100101 Firefox/27.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: PHPSESSID=itbms92ndcea9o8f4tcbfpsm2r2na3o0ioebelh9b0fucs06mpr1;
fe_typo_user=a9682cd3423a1e558c956ab49641251b; currency=USD;
location=OT;
__utma=49103283.176983647.1397562265.1397562265.1397562265.1;
__utmc=49103283;
__utmz=49103283.1397562265.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
be_typo_user=a49b1cc985e75a936d94171a8ace0a4b; mypanel=up;
typo3-login-cookiecheck=true;
phpMyAdmin=itbms92ndcea9o8f4tcbfpsm2r2na3o0ioebelh9b0fucs06mpr1
Cache-Control: max-age=0

N/VS337D^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(^W242@
^@@^F%,^?^@^@^A^?^@^@^A^W377:200/S^\241265261P^P^Ac376^\^@^@N/VS0E^K^@^P^A^@^@^P^A^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^A^B^W243@^@@^F$O^?^@^@^A^?^@^@^A^W377:200/S^\241265261P^X^Ac376366^@^@200
204
-----------------------------Varnish Cache CLI 1.0
-----------------------------
Linux,3.11.10-7-default,x86_64,-sfile,-smalloc,-hcritbit

Type 'help' for command list.
Type 'quit' to close CLI session.
N/VSYE^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212302@
^@@^F262^K^?^@^@^A^?^@^@^A244377^W302^\241265261:2000-P^P^A^376^\^@^@N/VS275E^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W244@^@@^F$316^?^@^@^A^?^@^@^A^W377:2000-^\241265261P^X^Ac376v^@^@101
76
Unknown request.
Type 'help' for more info.
all commands are in lower-case.
N/VS315E^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212303@
^@@^F262^?^@^@^A^?^@^@^A244377^W302^\241265261:2000207P^P^A^376^\^@^@N/VF^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W245@^@@^F$315^?^@^@^A^?^@^@^A^W377:2000207^\241265261P^X^Ac376v^@^@101
76
Unknown request.
Type 'help' for more info.
all commands are in lower-case.

N/VS^TF^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212304@^@@^F262

 ^?^@^@^A^?^@^@^A244377^W302^\241265261:2000341P^P^A^376^\^@^@N/VS9F^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W246@^@@^F$314^?^@^@^A^?^@^@^A^W377:2000341^\241265261P^X^Ac376v^@^@101
76
Unknown request.
Type 'help' for more info.
all commands are in lower-case.

N/VSFF^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212305@
^@@^F262^H^?^@^@^A^?^@^@^A244377^W302^\241265261:2001;P^P^A^376^\^@^@N/VSrF
^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W247@^@@^F$313^?^@^@^A^?^@^@^A^W377:2001;^\241265261P^X^Ac376v^@^@101
76
Unknown request.
Type 'help' for more info.
all commands are in lower-case.

N/VS~F^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212306@
^@@^F262^G^?^@^@^A^?^@^@^A244377^W302^\241265261:2001225P^P^A^376^\^@^@N/VS
242F^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W250@^@@^F$312^?^@^@^A^?^@^@^A^W377:2001225^\241265261P^X^Ac376v^@^@101
76
Unknown request.
Type 'help' for more info.
all commands are in lower-case.

N/VS262F^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212307@
^@@^F262^F^?^@^@^A^?^@^@^A244377^W302^\241265261:2001357P^P^A^376^\^@^@N/VS355F^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W251@^@@^F$311^?^@^@^A^?^@^@^A^W377:2001357^\241265261P^X^Ac376v^@^@101
76  lines 18-49

N/VS#Y^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212314@
^@@^F262^A^?^@^@^A^?^@^@^A244377^W302^\241265261:2003261P^P^A^376^\^@^@N/VS"]^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W256@^@@^F$304^?^@^@^A^?^@^@^A^W377:2003261^\241265261P^X^Ac376v^@^@101
76
Unknown request.
Type 'help' for more info.
all commands are in lower-case.

N/VSN]^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212315@
^@@^F262^@^?^@^@^A^?^@^@^A244377^W302^\241265261:2004^KP^P^A^376^\^@^@N/VS
336a^K^@220^@^@^@220^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^B^@202^W257@^@@^F$303^?^@^@^A^?^@^@^A^W377:2004^K^\241265261P^X^Ac376v^@^@101
76
Unknown request.
Type 'help' for more info.
all commands are in lower-case.

N/VS^Fb^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212316@
^@@^F261377^?^@^@^A^?^@^@^A244377^W302^\241265261:2004eP^P^A^376^\^@^@212/VS320U^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212317@
^@@^F261376^?^@^@^A^?^@^@^A244377^W302^\241265261:2004eP^Q^A^376^\^@^@212/VS3V^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(^W260@
^@@^F%^^^?^@^@^A^?^@^@^A^W377:2004e^\241265262P^Q^Ac376^\^@^@212/VSgV^K^@6^@^@^@6^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^H^@E^@^@(212320@
^@@^F261375^?^@^@^A^?^@^@^A244377^W302^\241265262:2004fP^P^A^376^\^@^@
lines 57-84/84 (END)
63f341734581b167c7b698169bdd2510?d=identicon&s=25 Lukas Tribus (Guest)
on 2014-04-22 11:33
(Received via mailing list)
> Thanks Lukas,
>
> here are the O/P

Please post the capture file.
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2014-04-22 11:36
(Received via mailing list)
Hello!

On Tue, Apr 22, 2014 at 12:55:07PM +0530, Joydeep Bakshi wrote:

>
> varnishd[16984]: CLI telnet 127.0.0.1 42212 127.0.0.1 6082 Wr 101 Unknown
> }
>
> Can anyone please suggest the possible reason which is causing the problem ?

It looks like you've configured nginx to pass http to varnish CLI
port.  For obvious reasons this isn't going to work.

--
Maxim Dounin
http://nginx.org/
3f3ac66afcf2830905f13da6c93adb5e?d=identicon&s=25 Joydeep Bakshi (Guest)
on 2014-04-22 12:01
(Received via mailing list)
Attachment: tcp6082-traffic.cap (4 KB)
@Lukas - attached is the cap file

@Maxim -  after starting varnish only the following port comes up

# netstat -nat | grep 60
tcp        0      0 0.0.0.0:6082            0.0.0.0:*
LISTEN
tcp        0      0 :::6082                 :::*
LISTEN
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2014-04-22 12:21
(Received via mailing list)
Hello!

On Tue, Apr 22, 2014 at 03:30:37PM +0530, Joydeep Bakshi wrote:

> @Lukas - attached is the cap file
>
> @Maxim -  after starting varnish only the following port comes up
>
> # netstat -nat | grep 60
> tcp        0      0 0.0.0.0:6082            0.0.0.0:*               LISTEN
> tcp        0      0 :::6082                 :::*                    LISTEN

Check varnish starup options.  As per documentation, the "-a"
argument of the varnishd is what you have to check:

https://www.varnish-cache.org/docs/4.0/reference/v...
https://www.varnish-cache.org/docs/4.0/tutorial/pu...

Anyway, it doesn't looks like something nginx-related.

> > > My setting works well  through nginx->apache but not through
> > >  the nginx starts throwing following error and browser also shows "*Zero
> > > request.#012Type 'help' for more info.#012all commands are in lower-case.
> > >
> > _______________________________________________
> > nginx mailing list
> > nginx@nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
> >


> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx


--
Maxim Dounin
http://nginx.org/
63f341734581b167c7b698169bdd2510?d=identicon&s=25 Lukas Tribus (Guest)
on 2014-04-22 12:22
(Received via mailing list)
> @Lukas - attached is the cap file

The request is bogus, imho. A GET request should not contain a body, it
doesn't
makes sense.



> @Maxim - after starting varnish only the following port comes up
>
> # netstat -nat | grep 60
> tcp 0 0 0.0.0.0:6082<http://0.0.0.0:6082>
> 0.0.0.0:* LISTEN
> tcp 0 0 :::6082 :::* LISTEN

You are administrating and configuring this server, find out why and fix
it.



Lukas
3f3ac66afcf2830905f13da6c93adb5e?d=identicon&s=25 Joydeep Bakshi (Guest)
on 2014-04-22 15:09
(Received via mailing list)
Dear all,

Problem Solved.

Here is the steps required to fix it on opensuse 13.1

varnish listen to port 80 as default in opensuse and there is no port
6081
. Hence /etc/sysconfig/varnish has to be edited to add "-a :6081"  like
below


VARNISHD_PARAMS="-f /etc/varnish/vcl.conf -a:6081 -T:6082 -s
file,/var/cache/varnish,1M -u varnish"


After restarting ; varnish provides 6081 port to be used with proxy_pass


Thanks for the responses
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.