2021-08-21 19:51:33 +02:00
|
|
|
# BASIC SCODOC 9 CONFIG FOR NGINX
|
|
|
|
# EV, Aug 2021
|
|
|
|
|
|
|
|
server {
|
|
|
|
# listen on port 80 (http)
|
|
|
|
listen 80;
|
|
|
|
server_name _;
|
|
|
|
location / {
|
|
|
|
# redirect any requests to the same URL but on https
|
|
|
|
return 301 https://$host$request_uri;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
server {
|
|
|
|
# listen on port 443 (https)
|
|
|
|
listen 443 ssl;
|
|
|
|
server_name _;
|
|
|
|
# location of the self-signed SSL certificate
|
|
|
|
ssl_certificate /opt/scodoc-data/certs/cert.pem;
|
|
|
|
ssl_certificate_key /opt/scodoc-data/certs/key.pem;
|
|
|
|
# write access and error logs to /var/log
|
2021-08-30 11:03:24 +02:00
|
|
|
access_log /var/log/nginx/scodoc_access.log;
|
|
|
|
error_log /var/log/nginx/scodoc_error.log;
|
2021-08-21 19:51:33 +02:00
|
|
|
location / {
|
|
|
|
# forward application requests to the gunicorn server
|
|
|
|
proxy_pass http://localhost:8000;
|
|
|
|
proxy_redirect off;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
2021-09-16 16:05:37 +02:00
|
|
|
proxy_set_header X-Forwarded-Proto https;
|
2021-09-18 21:59:54 +02:00
|
|
|
client_max_body_size 16m;
|
2021-08-21 19:51:33 +02:00
|
|
|
}
|
2021-08-30 15:53:09 +02:00
|
|
|
location /ScoDoc/static {
|
2021-08-21 19:51:33 +02:00
|
|
|
# handle static files directly, without forwarding to the application
|
|
|
|
alias /opt/scodoc/app/static;
|
2021-08-30 15:53:09 +02:00
|
|
|
expires 1d;
|
|
|
|
}
|
|
|
|
location /ScoDoc/static/bootstrap {
|
|
|
|
# (temp.) exception: home page using flask_bootstrap !
|
|
|
|
proxy_pass http://localhost:8000;
|
|
|
|
proxy_redirect off;
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
2021-09-14 00:07:10 +02:00
|
|
|
}
|
|
|
|
location /favicon.ico {
|
|
|
|
alias /opt/scodoc/app/static/icons/favicon.ico;
|
|
|
|
}
|
2021-08-21 19:51:33 +02:00
|
|
|
}
|