I am trying to configure Varnish on Nginx web server.
Varnish Configuration
In the file /etc/varnish/default.vcl
vcl 4.0;
backend default {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
}
sub vcl_backend_response {
set beresp.ttl = 10s;
set beresp.grace = 1h;
}
sub vcl_deliver {
}
In the file /etc/default/varnish
START=yes
NFILES=131072
MEMLOCK=82000
DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,256m"
Nginx Configuration
In the virtual host file /etc/nginx/sites-enabled/domain
server {
listen 8080;
root /var/www/html/domain.com/public_html;
index index.html index.htm index.php;
server_name domain.com www.domain.com;
include hhvm.conf;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
This configuration is not working. When I open domain.com
on web browser the site does not show anything, but web I open domain.com:8080
website works.
When I changed port to listen 80
in virtual host, then domain.com
works but Varnish is not working on both port 80
and 8080
.
Result After running curl -I
on both port
Result After running curl -I on both port
How can I fix this.