mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-12-12 14:17:46 +00:00
4252de9340
By using variables in the nginx configuration to point to lms/cms, we allow nginx not to require that lms and cms are up to run. This is convenient for debugging production settings: just launch an nginx, then runserver in an lms.
66 lines
1.9 KiB
Plaintext
66 lines
1.9 KiB
Plaintext
server {
|
|
listen 80;
|
|
server_name £{CMS_HOST};
|
|
|
|
# Prevent invalid display courseware in IE 10+ with high privacy settings
|
|
add_header P3P 'CP="Open edX does not have a P3P policy."';
|
|
|
|
# Nginx does not support nested condition or or conditions so
|
|
# there is an unfortunate mix of conditonals here.
|
|
|
|
client_max_body_size 100M;
|
|
|
|
rewrite ^(.*)/favicon.ico$ /static/images/favicon.ico last;
|
|
|
|
# Disables server version feedback on pages and in headers
|
|
server_tokens off;
|
|
|
|
location @proxy_to_cms_app {
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
proxy_set_header X-Forwarded-For $remote_addr;
|
|
proxy_set_header Host $http_host;
|
|
proxy_redirect off;
|
|
|
|
# Docker resolver
|
|
resolver 127.0.0.11 valid=10s;
|
|
set $upstream cms;
|
|
proxy_pass http://$upstream:8000;
|
|
}
|
|
|
|
location / {
|
|
try_files $uri @proxy_to_cms_app;
|
|
}
|
|
|
|
location ~ ^/static/(?P<file>.*) {
|
|
root /openedx/data/cms;
|
|
try_files /staticfiles/$file /course_static/$file =404;
|
|
|
|
# return a 403 for static files that shouldn't be
|
|
# in the staticfiles directory
|
|
location ~ ^/static/(?:.*)(?:\.xml|\.json|README.TXT) {
|
|
return 403;
|
|
}
|
|
|
|
# Set django-pipelined files to maximum cache time
|
|
location ~ "/static/(?P<collected>.*\.[0-9a-f]{12}\..*)" {
|
|
expires max;
|
|
# Without this try_files, files that have been run through
|
|
# django-pipeline return 404s
|
|
try_files /staticfiles/$collected /course_static/$collected =404;
|
|
}
|
|
|
|
# Set django-pipelined files for studio to maximum cache time
|
|
location ~ "/static/(?P<collected>[0-9a-f]{7}/.*)" {
|
|
expires max;
|
|
|
|
# Without this try_files, files that have been run through
|
|
# django-pipeline return 404s
|
|
try_files /staticfiles/$collected /course_static/$collected =404;
|
|
}
|
|
|
|
# Expire other static files immediately (there should be very few / none of these)
|
|
expires epoch;
|
|
}
|
|
}
|