diff --git a/docker-compose.yml b/docker-compose.yml index 9b17065..953aadc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,4 +5,10 @@ services: restart: always build: . ports: - - '3000:3000' \ No newline at end of file + - '3000:80' + webserver: + container_name: webserver + restart: unless-stopped + build: nginx + ports: + - '80:80' \ No newline at end of file diff --git a/next.config.js b/next.config.js index 5a3fc12..9df7241 100644 --- a/next.config.js +++ b/next.config.js @@ -11,6 +11,6 @@ module.exports = withSass({ return config }, env: { - GRAPHQL_API_URI: 'http://localhost:3000/api/graphql' + GRAPHQL_API_URI: 'http://localhost/api/graphql' } }) diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 0000000..8dc07a4 --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,5 @@ +FROM nginx + +RUN rm /etc/nginx/conf.d/default.conf + +COPY default.conf /etc/nginx/conf.d/ \ No newline at end of file diff --git a/nginx/default.conf b/nginx/default.conf new file mode 100644 index 0000000..e4898a3 --- /dev/null +++ b/nginx/default.conf @@ -0,0 +1,24 @@ +server { + listen 80; + server_name localhost; + + # location / { + # proxy_pass http://apollo-next-graphql:3000; + # } + + location / { + proxy_pass http://apollo-next-graphql:3000; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + +}