anyone figured how to deploy growthbook under CF w...
# ask-questions
b
anyone figured how to deploy growthbook under CF with only one EC2 machine? Have been trying to do this for the past week without any success...
For anyone stuck as I was all you need is nginx. Extend docker-compose with additional image:
Copy code
nginx:
    container_name: nginx
    image: "nginx:1.23-alpine"
    ports:
      - 80:80
    depends_on:
      - growthbook
    volumes:
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf

...

- APP_ORIGIN=<http://localhost>
- API_HOST=<http://localhost/backapi>
and the nginx.conf file:
Copy code
worker_processes 1;

events { worker_connections 1024; }

http {

    sendfile on;

    upstream docker-app {
        server growthbook:3000;
    }

    upstream docker-api {
        server growthbook:3100;
    }

    proxy_set_header   Host $host;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   X-Forwarded-Host $server_name;

    server {
        listen 80;

        location / {
            proxy_pass         <http://docker-app>;
            proxy_redirect     off;
        }

        location /backapi {
            rewrite /backapi/(.*) /$1  break;
            proxy_pass         <http://docker-api/>;
            proxy_redirect     off;
            proxy_set_header   Host $host;
        }
    }
}