mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-27 02:43:01 +00:00
92 lines
2.5 KiB
Plaintext
92 lines
2.5 KiB
Plaintext
# the upstream component nginx needs to connect to
|
|
upstream note {
|
|
server unix:///var/www/note_kfet/note_kfet.sock; # file socket
|
|
}
|
|
|
|
{% if note.doc_enabled %}
|
|
# Redirect doc HTTP to doc HTTPS
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
server_name {{ note.doc_url }};
|
|
|
|
location / {
|
|
return 301 https://{{ note.doc_url }}$request_uri;
|
|
}
|
|
}
|
|
|
|
# configuration of the documentation website
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
|
|
server_name {{ note.doc_url }};
|
|
root /var/www/documentation;
|
|
charset utf-8;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/{{ note.server_name }}/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/{{ note.server_name }}/privkey.pem;
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
}
|
|
{% endif %}
|
|
|
|
# Redirect HTTP to nk20 HTTPS
|
|
server {
|
|
listen 80 default_server;
|
|
listen [::]:80 default_server;
|
|
|
|
location / {
|
|
return 301 https://{{ note.server_name }}$request_uri;
|
|
}
|
|
}
|
|
|
|
# Redirect all HTTPS to nk20 HTTPS
|
|
server {
|
|
listen 443 ssl default_server;
|
|
listen [::]:443 ssl default_server;
|
|
|
|
location / {
|
|
return 301 https://{{ note.server_name }}$request_uri;
|
|
}
|
|
|
|
ssl_certificate /etc/letsencrypt/live/{{ note.server_name }}/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/{{ note.server_name }}/privkey.pem;
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
}
|
|
|
|
# configuration of the server
|
|
server {
|
|
listen 443 ssl;
|
|
listen [::]:443 ssl;
|
|
|
|
# the port your site will be served on
|
|
# the domain name it will serve for
|
|
server_name {{ note.server_name }}; # substitute your machine's IP address or FQDN
|
|
charset utf-8;
|
|
|
|
# max upload size
|
|
client_max_body_size 75M; # adjust to taste
|
|
|
|
# Django media
|
|
location /media {
|
|
alias /var/www/note_kfet/media; # your Django project's media files - amend as required
|
|
}
|
|
|
|
location /static {
|
|
alias /var/www/note_kfet/static; # your Django project's static files - amend as required
|
|
}
|
|
|
|
# Finally, send all non-media requests to the Django server.
|
|
location / {
|
|
uwsgi_pass note;
|
|
include /etc/nginx/uwsgi_params;
|
|
}
|
|
|
|
ssl_certificate /etc/letsencrypt/live/{{ note.server_name }}/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/{{ note.server_name }}/privkey.pem;
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
}
|