Skip to content

Commit

Permalink
chore: add support for environment specific nginx configuration
Browse files Browse the repository at this point in the history
This allows for example CSP headers to be defined in a pipeline on a
per-environment basis.

Ref HP-2363
  • Loading branch information
voneiden committed Apr 9, 2024
1 parent 8537b06 commit 96e6b58
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .prod/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pid /tmp/nginx.pid; #for running as non-root
pid /tmp/nginx.pid; #for running as non-root

events {
worker_connections 4096; ## Default: 1024
Expand All @@ -10,10 +10,10 @@ http {
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;

include /etc/nginx/mime.types;
default_type application/octet-stream;

server {
listen 8080;
server_name localhost;
Expand All @@ -29,11 +29,12 @@ http {
location / {
root /usr/share/nginx/html;
try_files $uri /index.html;
include /etc/nginx/env/nginx_env.conf;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
}
2 changes: 2 additions & 0 deletions .prod/nginx_env.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This is a placeholder file for additional environment configuration
# Actual content is defined by pipeline.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ COPY --from=staticbuilder /app/build /usr/share/nginx/html

# Copy nginx config
COPY .prod/nginx.conf /etc/nginx/
RUN mkdir /etc/nginx/env
COPY .prod/nginx_env.conf /etc/nginx/env

# Copy default environment config and setup script
# Copy package.json so env.sh can read it
Expand Down

0 comments on commit 96e6b58

Please sign in to comment.