Browse Source

NGINX skeleton for https

https
jakobsn 5 years ago
parent
commit
96215ad1ff
3 changed files with 27 additions and 2 deletions
  1. +1
    -2
      src/app/main.py
  2. +4
    -0
      src/app/views/app.py
  3. +22
    -0
      src/entrypoint.sh

+ 1
- 2
src/app/main.py View File

@@ -1,7 +1,6 @@
from views.app import app


if __name__ == "__main__":
app.run()

# Use webpy module to create a wsgi function
application = app.wsgifunc()

+ 4
- 0
src/app/views/app.py View File

@@ -10,6 +10,7 @@ from views.project import Project
from views.index import Index
from views.apply import Apply


# Define application routes
urls = (
'/', 'Index',
@@ -48,3 +49,6 @@ def session_hook():

app.add_processor(web.loadhook(session_hook))

app = app.wsgifunc()



+ 22
- 0
src/entrypoint.sh View File

@@ -10,6 +10,9 @@ USE_STATIC_PATH=${STATIC_PATH:-'/app/static'}
# Get the listen port for Nginx, default to 8080
USE_LISTEN_PORT=${LISTEN_PORT:-8080}

#if [ -f /app/nginx.conf ]; then
# cat /app/nginx.conf > /etc/nginx/conf.d/nginx.conf
#else
content_server='server {\n'
content_server=$content_server" listen ${USE_LISTEN_PORT};\n"
content_server=$content_server' location / {\n'
@@ -21,6 +24,25 @@ content_server=$content_server" alias $USE_STATIC_PATH;\n"
content_server=$content_server' }\n'
content_server=$content_server'}\n'


# Configuration skeleton for using SSL
# https://nginx.org/en/docs/http/configuring_https_servers.html
#content_server=$content_server'server {\n'
#content_server=$content_server" listen 443 ssl http2;\n"
#content_server=$content_server' ssl_certificate <certificate .crt file>;\n'
#content_server=$content_server' ssl_certificate_key <certificate .key file>;\n'
#content_server=$content_server' ssl_protocols <optional protocols>;\n'
#content_server=$content_server' ssl_ciphers <optional ciphers>;\n'
#content_server=$content_server' location / {\n'
#content_server=$content_server' include uwsgi_params;\n'
#content_server=$content_server' uwsgi_pass unix:///tmp/uwsgi.sock;\n'
#content_server=$content_server' }\n'
#content_server=$content_server" location $USE_STATIC_URL {\n"
#content_server=$content_server" alias $USE_STATIC_PATH;\n"
#content_server=$content_server' }\n'
#content_server=$content_server'}\n'


# Save generated server /etc/nginx/conf.d/nginx.conf
printf "$content_server" > /etc/nginx/conf.d/nginx.conf


Loading…
Cancel
Save