Skip to content

Commit c940705

Browse files
committed
nginx conf
1 parent 310a25c commit c940705

File tree

6 files changed

+58
-14
lines changed

6 files changed

+58
-14
lines changed

core/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ RUN pip install --no-cache-dir -r requirements.txt
1212
COPY ./ /app/
1313
#RUN python manage.py collectstatic --noinput
1414

15-
ENTRYPOINT ["python", "manage.py", "runserver", "0.0.0.0:8000"]
15+
ENTRYPOINT ["gunicorn", "plt.wsgi", "-b", "0.0.0.0:8000"]

core/plt/settings.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,17 @@
2828
# SECURITY WARNING: don't run with debug turned on in production!
2929
DEBUG = True
3030

31-
ALLOWED_HOSTS = ["plus.or.kr"]
3231

3332

3433
AUTH_USER_MODEL='base.Team'
3534

35+
CORS_ORIGIN_WHITELIST = [
36+
"https://firewall.postech.studio",
37+
"http://localhost:3000"
38+
]
39+
CORS_ALLOW_CREDENTIALS = True
40+
41+
ALLOWED_HOSTS = ["plus.or.kr"]
3642

3743
# Application definition
3844

@@ -47,6 +53,7 @@
4753
'sqli',
4854
'xss',
4955
'shop',
56+
'flag'
5057
]
5158

5259
MIDDLEWARE = [
@@ -57,6 +64,8 @@
5764
'django.contrib.auth.middleware.AuthenticationMiddleware',
5865
'django.contrib.messages.middleware.MessageMiddleware',
5966
'django.middleware.clickjacking.XFrameOptionsMiddleware',
67+
'corsheaders.middleware.CorsMiddleware',
68+
'django.middleware.common.CommonMiddleware',
6069
]
6170

6271
ROOT_URLCONF = 'plt.urls'
@@ -114,9 +123,9 @@
114123
# Internationalization
115124
# https://docs.djangoproject.com/en/3.1/topics/i18n/
116125

117-
LANGUAGE_CODE = 'en-us'
126+
LANGUAGE_CODE = 'ko-kr'
118127

119-
TIME_ZONE = 'UTC'
128+
TIME_ZONE = 'Asia/Seoul'
120129

121130
USE_I18N = True
122131

core/requirements.txt

+7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
asgiref==3.3.1
2+
cffi==1.14.4
3+
cryptography==3.3.1
24
Django==3.1.5
5+
django-cors-headers==3.6.0
6+
gunicorn==20.0.4
7+
pycparser==2.20
8+
PyMySQL==1.0.2
39
pytz==2020.5
10+
six==1.15.0
411
sqlparse==0.4.1

docker-compose.yml

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
version: '3.3'
22

3-
volumes:
4-
plt-mysql-data:
5-
63
services:
4+
nginx:
5+
build: ./nginx
6+
restart: always
7+
links:
8+
- core
9+
ports:
10+
- 17354:17354
11+
712
db:
813
image: mysql:latest
9-
volumes:
10-
- "plt-mysql-data:/var/lib/mysql"
1114
restart: always
12-
ports:
13-
- 37500:3306
15+
expose:
16+
- 3306
1417
environment:
15-
MYSQL_DATABASE: "plt"
18+
#MYSQL_DATABASE: "plt"
1619
MYSQL_USER: "beta"
1720
MYSQL_PASSWORD: "kawaikawai"
1821
MYSQL_ROOT_PASSWORD: "betaiskawaikawai"
@@ -25,5 +28,11 @@ services:
2528

2629
core:
2730
build: core
28-
ports:
29-
- 17354:8000
31+
links:
32+
- db
33+
depends_on:
34+
- db
35+
volumes:
36+
- "./core/data/db.sqlite3:/app/db.sqlite3"
37+
expose:
38+
- 8000

nginx/Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM nginx
2+
3+
RUN rm /etc/nginx/conf.d/default.conf
4+
COPY nginx.conf /etc/nginx/conf.d/

nginx/nginx.conf

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
server {
2+
listen 17354;
3+
4+
location / {
5+
allow 127.0.0.1;
6+
proxy_pass http://core:8000;
7+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
8+
proxy_set_header Host $host;
9+
proxy_redirect off;
10+
}
11+
12+
location /static/ {
13+
alias /static/;
14+
}
15+
}

0 commit comments

Comments
 (0)