From 5ba6479171784f87eddb57fd7ff35ee3e8a5c62b Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Wed, 23 Dec 2015 13:49:31 -0600 Subject: [PATCH] connect flask API with nginx --- ctf.nginx | 8 ++++++++ server/api/models.py | 3 ++- server/app.py | 1 - web/index.html | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ctf.nginx b/ctf.nginx index e992e67..cae807d 100644 --- a/ctf.nginx +++ b/ctf.nginx @@ -10,4 +10,12 @@ server { location / { try_files $uri $uri/ =404; } + + location ~ /api { + 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_pass http://localhost:8000; + proxy_redirect off; + } } \ No newline at end of file diff --git a/server/api/models.py b/server/api/models.py index 30b9456..c3ddbfe 100644 --- a/server/api/models.py +++ b/server/api/models.py @@ -1,3 +1,4 @@ from flask.ext.sqlalchemy import SQLAlchemy -db = SQLAlchemy() \ No newline at end of file +db = SQLAlchemy() + diff --git a/server/app.py b/server/app.py index 7ddd374..4478f59 100644 --- a/server/app.py +++ b/server/app.py @@ -5,7 +5,6 @@ import config import json import sys -from api.api import api from flask import Flask app = Flask(__name__) diff --git a/web/index.html b/web/index.html index e49fc63..77a0d35 100644 --- a/web/index.html +++ b/web/index.html @@ -1,6 +1,7 @@ EasyCTF 2016 +

Hello, EasyCTF!