You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
1017B

  1. #! /usr/bin/env bash
  2. set -e
  3. /uwsgi-nginx-entrypoint.sh
  4. # Get the URL for static files from the environment variable
  5. USE_STATIC_URL=${STATIC_URL:-'/static'}
  6. # Get the absolute path of the static files from the environment variable
  7. USE_STATIC_PATH=${STATIC_PATH:-'/app/static'}
  8. # Get the listen port for Nginx, default to 8080
  9. USE_LISTEN_PORT=${LISTEN_PORT:-8080}
  10. content_server='server {\n'
  11. content_server=$content_server" listen ${USE_LISTEN_PORT};\n"
  12. content_server=$content_server' location / {\n'
  13. content_server=$content_server' include uwsgi_params;\n'
  14. content_server=$content_server' uwsgi_pass unix:///tmp/uwsgi.sock;\n'
  15. content_server=$content_server' }\n'
  16. content_server=$content_server" location $USE_STATIC_URL {\n"
  17. content_server=$content_server" alias $USE_STATIC_PATH;\n"
  18. content_server=$content_server' }\n'
  19. content_server=$content_server'}\n'
  20. # Save generated server /etc/nginx/conf.d/nginx.conf
  21. printf "$content_server" > /etc/nginx/conf.d/nginx.conf
  22. exec "$@"