diff --git a/MUOR/MUOR/configs/muor.conf b/MUOR/MUOR/configs/muor.conf new file mode 100644 index 000000000..b8b44a248 --- /dev/null +++ b/MUOR/MUOR/configs/muor.conf @@ -0,0 +1,64 @@ +map $http_upgrade $connection_upgrade { + default upgrade; + '' close; +} + +upstream django { + server localhost:8080; +} + +server { + if ($host = randomsec.projektstudencki.pl) { + return 301 https://$host$request_uri; + } + listen 80 reuseport; + server_name randomsec.projektstudencki.pl + charset utf-8; + return 404; +} + +# configuration of the server +server { + # the port your site will be served on + listen 443 ssl http2 reuseport; + # the domain name it will serve for + server_name randomsec.projektstudencki.pl + charset utf-8; + + # max upload size + client_max_body_size 75M; # adjust to taste + +# location /static { +# alias /path/to/static; #TODO add path +# expires 30d; +# access_log off; +# add_header Pragma public; +# add_header Cache-Control "public"; +# } + + error_page 500 502 503 504 404 403 /error.html; + + location = /error.html { + add_header Content-Type text/html; + return 200 '

Loading your instance...

'; + } + + location /logout/ { + proxy_pass http://django; + } + + # Finally, send all non-media requests to the Django server. + location / { + if ($cookie_sessionid = ""){ + proxy_pass http://django; # TODO prolly change that to uwsgi_pass + } + } + + ssl_certificate /etc/letsencrypt/live/randomsec.projektstudencki.pl/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/randomsec.projektstudencki.pl/privkey.pem; # managed by Certbot + include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot + + + # add_header Strict-Transport-Security max-age=31536000; +} \ No newline at end of file diff --git a/MUOR/MUOR/configs/muor_before_location_block.conf b/MUOR/MUOR/configs/muor_before_location_block.conf index e3bac1f84..476402009 100644 --- a/MUOR/MUOR/configs/muor_before_location_block.conf +++ b/MUOR/MUOR/configs/muor_before_location_block.conf @@ -38,11 +38,11 @@ server { # add_header Cache-Control "public"; # } - error_page 500 502 503 504 404 /error.html; + error_page 500 502 503 504 404 403 /error.html; location = /error.html { add_header Content-Type text/html; - return 200 ''; + return 200 '

Loading your instance...

'; } location /logout/ { diff --git a/MUOR/MUOR/configs/nginx.conf b/MUOR/MUOR/configs/nginx.conf index 905ffa997..b42d0f3a3 100644 --- a/MUOR/MUOR/configs/nginx.conf +++ b/MUOR/MUOR/configs/nginx.conf @@ -1,11 +1,14 @@ -worker_processes 1; +user www-data; +worker_processes auto; +pid /run/nginx.pid; +include /etc/nginx/modules-enabled/*.conf; events { - worker_connections 1024; + worker_connections 768; + # multi_accept on; } http { - ## # Basic Settings ## @@ -27,8 +30,8 @@ http { # SSL Settings ## - ssl_protocols TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE - ssl_prefer_server_ciphers on; +# ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE +# ssl_prefer_server_ciphers on; ## # Logging Settings @@ -48,7 +51,7 @@ http { # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; - gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; ## diff --git a/MUOR/MUOR/settings.py b/MUOR/MUOR/settings.py index afc479883..ccee8f7a9 100644 --- a/MUOR/MUOR/settings.py +++ b/MUOR/MUOR/settings.py @@ -126,7 +126,7 @@ STATICFILES_DIRS = ( STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') -LOGIN_REDIRECT_URL = 'home' +LOGIN_REDIRECT_URL = 'loader' LOGOUT_REDIRECT_URL = 'home' # Default primary key field type diff --git a/MUOR/MUOR/urls.py b/MUOR/MUOR/urls.py index 66476216a..4a143369b 100644 --- a/MUOR/MUOR/urls.py +++ b/MUOR/MUOR/urls.py @@ -25,9 +25,8 @@ urlpatterns = [ path('admin/', admin.site.urls), path('', include('django.contrib.auth.urls')), path('signup/', SignUpView.as_view(), name='signup'), - path('welcome/', TemplateView.as_view(template_name='home.html'), - name='home'), - path('favicon.ico', RedirectView.as_view( - url=staticfiles_storage.url('images/favicon.ico'))), + path('loader/', TemplateView.as_view(template_name='loader.html'), name='loader'), + path('welcome/', TemplateView.as_view(template_name='home.html'), name='home'), + path('favicon.ico', RedirectView.as_view(url=staticfiles_storage.url('images/favicon.ico'))), path('', views.home, name='home') ] diff --git a/MUOR/MUOR/views.py b/MUOR/MUOR/views.py index 780c959ec..944f84540 100644 --- a/MUOR/MUOR/views.py +++ b/MUOR/MUOR/views.py @@ -1,6 +1,4 @@ -from django.contrib.auth import logout from django.contrib.auth.forms import UserCreationForm -from django.http import JsonResponse from django.shortcuts import redirect from django.urls import reverse_lazy from django.views import generic diff --git a/MUOR/db.sqlite3 b/MUOR/db.sqlite3 index 66b5fe754..b8f09abba 100644 Binary files a/MUOR/db.sqlite3 and b/MUOR/db.sqlite3 differ diff --git a/MUOR/templates/base.html b/MUOR/templates/base.html index bb3b175c6..0837aca71 100644 --- a/MUOR/templates/base.html +++ b/MUOR/templates/base.html @@ -2,8 +2,8 @@ - + {% block title %}MultiUserOpenRefine{% endblock %} @@ -25,5 +25,14 @@ + + + \ No newline at end of file diff --git a/MUOR/templates/loader.html b/MUOR/templates/loader.html new file mode 100644 index 000000000..6702a8658 --- /dev/null +++ b/MUOR/templates/loader.html @@ -0,0 +1,13 @@ + +{% extends 'base.html' %} + +{% block title %}Loader{% endblock %} + +{% block content %} +

Your instance is getting ready. Please wait...

+
+
+ Loading... +
+
+{% endblock %} \ No newline at end of file