I want to put nginx in front of Varnish, which at the same time will go back to nginx to serve some PHP (Drupal).
But I am only getting blank pages (from Varnish) with 200 response, but length 0. Only the first access after restarting varnish works, but then blank pages all the time.
This is the configuration for Nginx:
server{
listen 80;
server_name myserver
access_log /var/log/nginx/ssl_access.log main;
error_log /var/log/nginx/ssl_error.log warn;
location / {
proxy_pass http://127.0.0.1:6081;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}
Then the varnish configuration is just only the default, trying to debug:
backend default {
.host = "127.0.0.1";
.port = "8080";
}
And then again the nginx config for 8080 is:
server{
listen 8080;
access_log /var/log/nginx/fromvarnish.log main;
error_log /var/log/nginx/fromvarnisherror.log warn;
server_name myserver
location / {
try_files $uri /index.php?$query_string;
}
location ~ '\.php$|^/update.php' {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
}
}
Visiting my webpage only returns empty html but 200 response. No PHP error or anything. Access logs on Nginx are just access, no errors.
If I access directly from Varnish (either I access via port mywbpage.com:6081) or if I set it to port 80 it works.
If I set the php executing backend to Apache+php-fpm (instead of Nginx: nginx->varnish->apache) it also works properly (I have the same issue though if the php executer is HHVM but that might be a different problem).
EDIT: sorry that was wrong, if I use apache it works only if I uncheck drupal's default cache (cache pages for unauthenticated users). With nginx this doesn't matter, it never works regardless of this checkbox.
Any of you know something that can guide me?