Running nginx locally - CDCgov/prime-simplereport GitHub Wiki

Intro

This page helps guide us through setting up Nginx to run locally. This is optional to develop locally. (This setup may be needed to run the E2E tests in Docker. Editor's note: need to check this)

Prerequisites

Setup

  1. Copy the repo's nginx/default.conf file into your local nginx servers directory. This may look something like:
cp nginx/default.conf /usr/local/etc/nginx/servers/default.conf
  1. In the newly copied /usr/local/etc/nginx/servers/default.conf update any usage of
  • http://frontend:3000 to http://localhost:3000
  • http://backend:8080 to http://localhost:8080
  1. Copy the certs directory to your local Nginx directory. This may look something like:
cp -r certs /usr/local/etc/nginx
  1. Open your local nginx.conf file in the editor of your choice.
vi /usr/local/etc/nginx/nginx.conf
  1. In your local nginx.conf file, comment out the entire server block that is listening on port 8080. For example, the server block may look something like:
server {
   listen        8080;
   server_name   localhost;
   ...
   ... 
}
  1. You should now be able to start Nginx. Run sudo nginx. If you need to stop it, run sudo nginx -s stop.

  2. Create a '.env.localfile (if you don't have it already) in the repo'sfrontend/src` directory

touch frontend/src/.env.local
  1. Copy and save the content below into that newly created file:
REACT_APP_BASE_URL=https://localhost.simplereport.gov
REACT_APP_BACKEND_URL=https://localhost.simplereport.gov/api
PUBLIC_URL=/app/
REACT_APP_OKTA_ENABLED=true
REACT_APP_DISABLE_MAINTENANCE_BANNER=true
  1. You should now be able to run the app and access the app via https://localhost.simplereport.gov

Caveat

  • You may be unable to access the patient experience routes /pxp using this setup.