From 9a52c81bffb0965f92361d525803ab05e6778e11 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Sun, 9 Aug 2020 20:33:48 +0200 Subject: [PATCH] Simplify NGINX examples --- nginx_note.conf_docker | 32 ++++++++++++++++++-------------- nginx_note.conf_example | 37 +++++++++++++++---------------------- 2 files changed, 33 insertions(+), 36 deletions(-) diff --git a/nginx_note.conf_docker b/nginx_note.conf_docker index c40eb59e..020fe204 100644 --- a/nginx_note.conf_docker +++ b/nginx_note.conf_docker @@ -1,23 +1,27 @@ -upstream note { - server 127.0.0.1:8000; -} +# This is an example NGINX site configuration for note_kfet in Docker +# Only HTTP, please use a reverse proxy to secure it! server { - listen 80; - server_name note; + # Serve this site by default on HTTP + listen 80 default_server; + listen [::]:80 default_server; - location / { - proxy_pass http://note; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $host; - proxy_redirect off; - } + # Max upload size + client_max_body_size 75M; + # Django statics and media location /static { - alias /code/static/; + alias /code/static; + } + location /media { + alias /code/media; } - location /media { - alias /code/media/; + # Send all non-media requests to the Django server. + location / { + proxy_pass http://127.0.0.1:8000; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $host; + proxy_redirect off; } } diff --git a/nginx_note.conf_example b/nginx_note.conf_example index 204784d0..48958a3e 100644 --- a/nginx_note.conf_example +++ b/nginx_note.conf_example @@ -1,32 +1,25 @@ -# nginx_songbook.conf -# the upstream component nginx needs to connect to -upstream note{ - server unix:///var/www/note_kfet/note_kfet.sock; # file socket -} +# This is an example NGINX site configuration for note_kfet behind a reverse proxy +# Only HTTP, please use a reverse proxy to secure it! -# configuration of the server server { - # the port your site will be served on - listen 80; - # the domain name it will serve for - server_name note.example.org; # substitute your machine's IP address or FQDN - charset utf-8; + # Serve this site by default on HTTP + listen 80 default_server; + listen [::]:80 default_server; - # 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 - } + # Max upload size + client_max_body_size 75M; + # Django statics and media location /static { - alias /var/www/note_kfet/static; # your Django project's static files - amend as required + alias /var/www/note_kfet/static; + } + location /media { + alias /var/www/note_kfet/media; } - # Finally, send all non-media requests to the Django server. + # Send all non-media requests to the Django server. location / { - uwsgi_pass note; - include /var/www/note_kfet/uwsgi_params; # the uwsgi_params file you installed + uwsgi_pass unix:///var/www/note_kfet/note_kfet.sock; + include /etc/nginx/uwsgi_params; } }