problem with configuring varnish

#1
hi all,
i installed olsws and it works on 8088 (in listeners)
i installed varnish and config these file:
/etc/varnish/default.vcl :
put in backend :
.host = "my_server_ip"
.port = "8088"
-----------------------
/etc/sysconfig/varnish
put
VARNISH_LISTENER_PORT=8088
put now when i open on port 80 i just get error 503
what do i have to do?
 
#3
it worked, so tnx but i want that my ols works on 8088
what do i have to do?
do you think this problem has conection with firewall for example iptables of csf?
 

lsfoo

Administrator
#4
Hi Seyed,

If you mean you want to access 8088 to get to Varnish, then Varnish gets the page from OLS at another port, you just have to set OLS to another port.

Everything that used to be port 80 should be switched to 8088. Everything that was 8088 should be switched to another one, for example 8089.

I hope this helps,
Kevin
 
#5
no no no
i think i couldn't give you my main idea
i want that varnish is worked on port 80 and ols is worked on 8088
i pass all config but still get 503 error
and every thing goes fine when ols is worked on 8080 and reconfig(same config for port 8088) for port 8080
 

lsfoo

Administrator
#6
Hi Seyed,

Does it work if you use host 127.0.0.1 and port 8088? Your post suggested that you used "my_server_ip", I assume that means you used the outward facing IP, rather than localhost/127.0.0.1. As I mentioned in that thread, I was able to get it working with port 8088.

Let me know,
Kevin
 
#7
my config is now :
backend:
.host = "127.0.0.1"
.port = "8080"
and varnish:
LISTEN_VARNISH_PORT: 80
and it worked
but when put .port = "8088" (and set listener on ols to 8088) it gives me the 503 error
 

lsfoo

Administrator
#8
Hi Seyed,

When it is set to 8088, are you able to access the pages directly, rather than through Varnish?

Kevin
 

lsfoo

Administrator
#9
Seyed,

I noticed that you made a few posts regarding caching solutions.

I did not have any issues when trying Varnish cache myself, so I am not sure about what the problem is.

If you are interested, we do have a guide for installing the cache module, which may be enough for your uses.

A quick note if you decide to use our cache module, some more information regarding public/private caches can be found here.

Kevin
 
#11
Seyed,

I noticed that you made a few posts regarding caching solutions.

I did not have any issues when trying Varnish cache myself, so I am not sure about what the problem is.

If you are interested, we do have a guide for installing the cache module, which may be enough for your uses.

A quick note if you decide to use our cache module, some more information regarding public/private caches can be found here.

Kevin
they don't have problem with php 7?
 

lsfoo

Administrator
#12
Hi Seyed,

they don't have problem with php 7?
No, our cache module should not be impacted by php 7.

yes there is no problem for direct connection
but when i use varnish i (and ols on port 8088) have this problem
I just did a fresh install and it works.

Varnish version 4.1.1 - binary at /usr/local/sbin/varnishd

Code:
sudo /usr/local/sbin/varnishd
Gave me a warning message:
Warning: Neither -b nor -f given, won't start a worker child.
Master process started, use varnishadm to control it.

Code:
sudo /usr/local/sbin/varnishd -b 127.0.0.1:8088
/usr/local/lsws/bin/lswsctrl stop
/usr/local/lsws/bin/lswsctrl start
curl -i http://127.0.0.1:8088 // works
curl -i http://127.0.0.1:80     // works
What steps did you take?

Kevin
 
#13
the problem is that -> we got no warning or error message on starting or restarting the services
but when accessed to port 80 ( that varnish worked on it) we got 503 Error!!!!!!
 

lsfoo

Administrator
#14
Hi Seyed,

Try running the varnish log (for me it is sudo varnishlog).
If it says can't open log, you might not have the right permissions, or there is a problem with varnish, not with OLS.

If there are no warnings/errors, that means the log output is running.

When it is running, access a page at :80. Something should output.

Kevin

This is my output:

Code:
*   << BeReq    >> 3        
-   Begin          bereq 2 fetch
-   Timestamp      Start: 1455111989.738697 0.000000 0.000000
-   BereqMethod    GET
-   BereqURL       /
-   BereqProtocol  HTTP/1.1
-   BereqHeader    Host: MY_SERVER_IP
-   BereqHeader    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
-   BereqHeader    Upgrade-Insecure-Requests: 1
-   BereqHeader    User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.103 Safari/537.36
-   BereqHeader    Accept-Language: en-US,en;q=0.8
-   BereqHeader    X-Forwarded-For: MY_CLIENT_IP
-   BereqHeader    Accept-Encoding: gzip
-   BereqHeader    X-Varnish: 3
-   VCL_call       BACKEND_FETCH
-   VCL_return     fetch
-   BackendOpen    18 boot.default 127.0.0.1 8088 127.0.0.1 34284
-   Timestamp      Bereq: 1455111989.738942 0.000245 0.000245
-   Timestamp      Beresp: 1455111989.739239 0.000542 0.000297
-   BerespProtocol HTTP/1.1
-   BerespStatus   200
-   BerespReason   OK
-   BerespHeader   ETag: "6b4-5669dd6e-1052ec"
-   BerespHeader   Last-Modified: Thu, 10 Dec 2015 20:15:42 GMT
-   BerespHeader   Content-Type: text/html
-   BerespHeader   Content-Length: 942
-   BerespHeader   Accept-Ranges: bytes
-   BerespHeader   Content-Encoding: gzip
-   BerespHeader   Vary: Accept-Encoding
-   BerespHeader   Date: Wed, 10 Feb 2016 13:46:29 GMT
-   BerespHeader   Server: LiteSpeed
-   TTL            RFC 120 10 -1 1455111990 1455111990 1455111989 0 0
-   VCL_call       BACKEND_RESPONSE
-   VCL_return     deliver
-   Storage        malloc s0
-   ObjProtocol    HTTP/1.1
-   ObjStatus      200
-   ObjReason      OK
-   ObjHeader      ETag: "6b4-5669dd6e-1052ec"
-   ObjHeader      Last-Modified: Thu, 10 Dec 2015 20:15:42 GMT
-   ObjHeader      Content-Type: text/html
-   ObjHeader      Content-Length: 942
-   ObjHeader      Content-Encoding: gzip
-   ObjHeader      Vary: Accept-Encoding
-   ObjHeader      Date: Wed, 10 Feb 2016 13:46:29 GMT
-   ObjHeader      Server: LiteSpeed
-   Fetch_Body     3 length stream
-   Gzip           u F - 942 1716 80 80 7466
-   BackendReuse   18 boot.default
-   Timestamp      BerespBody: 1455111989.739546 0.000849 0.000306
-   Length         942
-   BereqAcct      379 0 379 265 942 1207
-   End
 
#15
when i use sudo varnishlog
it begins to do something like pinging
0 CLI - Rd ping
0 CLI - Wr 200 19 PONG 1455182721 1.0
0 CLI - Rd ping
0 CLI - Wr 200 19 PONG 1455182724 1.0
0 CLI - Rd ping
0 CLI - Wr 200 19 PONG 1455182727 1.0
0 CLI - Rd ping
0 CLI - Wr 200 19 PONG 1455182730 1.0
0 CLI - Rd ping
0 CLI - Wr 200 19 PONG 1455182733 1.0
0 CLI - Rd ping
0 CLI - Wr 200 19 PONG 1455182736 1.0
this log for time when every thing work well(varnish work on 80 and ols work on 8080)
i think there is no need for more answer about this matter because every thing works nice on 80 and 8080 and no one else have my problem so it's might because of my server firewall ruls
so thanks for your support
 
Top