i'm trying to configure a scalable symfony2 app, so i read this page https://cloud.google.com/compute/docs/load-balancing/http/cross-region-example
i did every thing like they said, is working with a simple nginx conf :
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
}
with that i get a positive check health and if i try http://ip_load_balancer i get the nginx's default page.
But when i try my real nginx's conf:
server {
listen 80;
server_name myapp-public.com;
root /usr/share/nginx/html/app-public/web;
recursive_error_pages off;
error_log /var/log/nginx/app_error.log;
access_log /var/log/nginx/app_access.log;
location / {
try_files $uri /app.php$is_args$args;
}
# PROD
location ~ ^/app\.php(/|$) {
internal;
fastcgi_pass php:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
fastcgi_intercept_errors on;
}
}
When i try http://ip_load_blancer, i get 502 Server Error. But when i try http://ip_vm1, i get my application (i open the http access from all to test).
Also all the check health fail. I don't really understand what's wrong, any idea?
Thanks.
After reading your comment here is what i think was my problem @George
You need to keep in mind that if the check health failed, there will be no redirect to the specific instance. ==> So i create a default conf for my nginx (i add ssl in the conf)
Second things, you have to accept traffic from your load balancer and health check from google to the instance's port 80 (and 443 in my case) cf.
==> https://cloud.google.com/compute/docs/load-balancing/http/cross-region-example#shutting_off_https_access_from_everywhere_but_the_load_balancing_service
I hope this help you, if you want more details, or if you don't understand something, just tell me, i will try to explain more.
PS : Sorry for the wait