Start adding virtual sites with nginx.
This commit is contained in:
parent
03778e9834
commit
4be5e93c9c
7 changed files with 68 additions and 29 deletions
52
compose.staging.yaml
Normal file
52
compose.staging.yaml
Normal file
|
@ -0,0 +1,52 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
web:
|
||||
build: ./wedding_site
|
||||
command: gunicorn wedding_site.wsgi:application --bind 0.0.0.0:8000
|
||||
volumes:
|
||||
- ./wedding_site/:/usr/src/app/
|
||||
- static_volume:/staticfiles
|
||||
- media_volume:/mediafiles
|
||||
expose:
|
||||
- 8000
|
||||
env_file:
|
||||
- ./.env.staging
|
||||
|
||||
nginx-proxy:
|
||||
container_name: nginx-proxy
|
||||
build: ./nginx
|
||||
restart: always
|
||||
ports:
|
||||
- 443:443
|
||||
- 8080:80
|
||||
volumes:
|
||||
- static_volume:/staticfiles
|
||||
- media_volume:/mediafiles
|
||||
- certs:/etc/nginx/certs
|
||||
- html:/usr/share/nginx/html
|
||||
- vhost:/etc/nginx/vhost.d
|
||||
- /var/run/docker.sock:/tmp/docker/sock:ro
|
||||
depends_on:
|
||||
- web
|
||||
|
||||
acme-companion:
|
||||
image: nginxproxy/acme-companion
|
||||
env_file:
|
||||
- ./.env.staging.proxy-companion
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
- certs:/etc/nginx/certs
|
||||
- html:/usr/share/nginx/html
|
||||
- vhost:/etc/nginx/vhost.d
|
||||
- acme:/etc/acme.sh
|
||||
depends_on:
|
||||
- nginx-proxy
|
||||
|
||||
volumes:
|
||||
static_volume:
|
||||
media_volume:
|
||||
certs:
|
||||
html:
|
||||
vhost:
|
||||
acme:
|
|
@ -1,4 +1,3 @@
|
|||
FROM docker.io/nginx
|
||||
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
COPY nginx.conf /etc/nginx/conf.d
|
||||
FROM docker.io/nginxproxy/nginx-proxy
|
||||
COPY vhost.d/default /etc/nginx/vhost.d/default
|
||||
COPY custom.conf /etc/nginx/conf.d/custom.conf
|
1
nginx/custom.conf
Normal file
1
nginx/custom.conf
Normal file
|
@ -0,0 +1 @@
|
|||
client_max_body_size 100M;
|
|
@ -1,25 +0,0 @@
|
|||
upstream wedding_site {
|
||||
server web:8000;
|
||||
}
|
||||
|
||||
server {
|
||||
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
proxy_pass http://wedding_site;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
proxy_redirect off;
|
||||
client_max_body_size 100M;
|
||||
}
|
||||
|
||||
location /static/ {
|
||||
alias /staticfiles/;
|
||||
}
|
||||
|
||||
location /media/ {
|
||||
alias /mediafiles/;
|
||||
}
|
||||
|
||||
}
|
9
nginx/vhost.d/default
Normal file
9
nginx/vhost.d/default
Normal file
|
@ -0,0 +1,9 @@
|
|||
location /static/ {
|
||||
alias /staticfiles/;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
}
|
||||
|
||||
location /media/ {
|
||||
alias /mediafiles/;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
}
|
BIN
wedding_site/primary/static/primary/favicon.ico
Executable file
BIN
wedding_site/primary/static/primary/favicon.ico
Executable file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
|
@ -111,6 +111,9 @@ USE_I18N = True
|
|||
|
||||
USE_TZ = True
|
||||
|
||||
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
||||
CSRF_TRUSTED_ORIGINS = os.environ.get("CSRF_TRUSTED_ORIGINS").split(" ")
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/5.0/howto/static-files/
|
||||
|
|
Loading…
Reference in a new issue