diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dc9b3c0..7eda06de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - fix problem with node-prune on production build - variable names in examples (https://github.com/ohmyform/ohmyform/issues/134) - error if /run/nginx already exists (https://github.com/ohmyform/ohmyform/pull/148) +- fix combine images ### Security diff --git a/Dockerfile b/Dockerfile index 0b1a5056..f783b4ab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -67,7 +67,7 @@ EXPOSE 3000 RUN mkdir -p /run/nginx/ RUN touch /usr/src/supervisord.log && chmod 777 /usr/src/supervisord.log COPY supervisord.conf /etc/supervisord.conf -COPY nginx.conf /etc/nginx/conf.d/ohmyform.conf +COPY nginx.conf /etc/nginx/nginx.conf CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] # CMD [ "yarn", "start:prod" ] diff --git a/nginx.conf b/nginx.conf index 62f533d1..4e3230cf 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,15 +1,54 @@ -server { - listen 3000; +user nginx; +worker_processes 1; +error_log /dev/stderr debug; +pid /var/run/nginx.pid; - location / { - proxy_pass http://localhost:4000; - proxy_redirect off; - proxy_set_header Host $host; - } +events { + worker_connections 1024; +} - location /graphql { - proxy_pass http://localhost:4100; - proxy_redirect off; - proxy_set_header Host $host; +http { + log_format json_combined escape=json + '{' + '"time_local":"$time_local",' + '"remote_addr":"$remote_addr",' + '"remote_user":"$remote_user",' + '"request":"$request",' + '"status": "$status",' + '"body_bytes_sent":"$body_bytes_sent",' + '"request_time":"$request_time",' + '"http_referrer":"$http_referer",' + '"http_user_agent":"$http_user_agent"' + '}'; + + access_log /var/log/nginx/access.log json_combined; + + server { + listen 3000; + + location / { + proxy_pass http://localhost:4000; + proxy_redirect off; + 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-Proto $scheme; + } + + location /graphql { + proxy_pass http://localhost:4100; + proxy_redirect off; + 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-Proto $scheme; + + # WebSocket support + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } } }