AlexandreVerhoye / nextjs-strapi-mongo-nginx-docker-starter

NextJS + Strapi + MongoDB + NGINX + Docker Starter
GNU General Public License v3.0
4 stars 0 forks source link
docker docker-compose mongodb nextjs nginx strapi

NextJS + Strapi + MongoDB + NGINX + Docker Starter

This boilerplate includes :

Configuration

Rename .env.example to .env :

  cp .env.example .env

You can modify 3 environment variables :

You can also modify the NGINX config for custom domain :

  # NextJS
  server {
    listen 80;
    server_name localhost; # Modify this line
    include server.conf;

    # Cache (jsx, css)
    location /_next/static {
      proxy_cache STATIC;
      proxy_pass http://nextjs_upstream;
    }

    # Cache (...static)
    location ~* ^/.*\\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|ttf)$ {
      proxy_cache STATIC;
      proxy_ignore_headers Cache-Control;
      proxy_cache_valid 60m;
      proxy_pass http://nextjs_upstream;
    }

    location / {
      proxy_pass          http://nextjs_upstream;
    }
  }

  # Strapi
  server {
    listen 80;
    server_name cms.localhost; # Modify this line
    include server.conf;

    location / {
      proxy_pass          http://strapi_upstream;
    }
  }
}

Disclaimer : SSL AND HTTPS isn't configured on this boilerplate

Deployment

To deploy this project run

  docker-compose up -d

You have to wait till Strapi is fully built and ready to be used (deps installation can take some times)

With the default configuration and with Strapi fully installed :