I'm stuck at some point in the installation of Varnish. This is how it looked like before the Varnish: Nginx Reverse Proxy + Apache + Centos 6 64 Bit
I installed the Varnish and set the ports as following. First of all we want to remove Nginx Reverse Proxy and switch to Apache completely. Because Varnish is not working properly at the moment.
DEFAULT.VCL
backend default {
.host = "127.0.0.1";
.port = "8080";
.first_byte_timeout = 60s;
.connect_timeout = 300s;
}
VARNISH
DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-u varnish -g varnish \
-S /etc/varnish/secret \
-s file,/var/lib/varnish/varnish_storage.bin,256m"
httpd.conf
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 8080
nginx-vhosts.conf
server {
listen 176.xx.xx.xx:80;
listen 127.0.0.1:80;
#listen [::1]:80;
server_name $hostname 176.xx.xx.xx;
root /var/www/html;
index index.html index.htm index.php;
include /etc/nginx/nginx-userdir.conf;
location / {
access_log off;
proxy_pass http://176.xx.xx.xx:8080;
proxy_set_header X-Client-IP $remote_addr;
proxy_set_header X-Accel-Internal /nginx_static_files;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
I used the curl -l command for localhost and domain.com. How should i set the ports and IPs in order to make Varnish work properly?
Localhost
[root@ns1 ~]# curl -I http://localhost
HTTP/1.1 200 OK
Date: Thu, 14 Jul 2016 11:35:43 GMT
Server: Apache/2
X-Powered-By: W3 Total Cache/0.9.4.1
Link: <http://******.com/wp-json/>; rel="https://api.w.org/"
Cache-Control: max-age=3600
Expires: Thu, 14 Jul 2016 12:35:43 GMT
Content-Type: text/html; charset=UTF-8
Vary: Accept-Encoding
X-Varnish: 2
Age: 0
Via: 1.1 varnish-v4
X-Cache: MISS
Connection: keep-alive
my domain.com
[root@ns1 ~]# curl -I http://my domain.com
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 14 Jul 2016 11:36:07 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 344285
Connection: close
Vary: Accept-Encoding
Last-Modified: Thu, 14 Jul 2016 11:30:57 GMT
ETag: "540dd-53796d5f31b86"
Accept-Ranges: bytes
Vary: Accept-Encoding,User-Agent
Cache-Control: public, must-revalidate, proxy-revalidate
Expires: Thu, 14 Jul 2016 12:30:57 GMT
X-Powered-By: W3 Total Cache/0.9.4.1
Pragma: public