add initial configurations

This commit is contained in:
prance 2022-01-30 14:54:51 +01:00
parent 46f8195ed9
commit dcf932b66d
2 changed files with 73 additions and 6 deletions

View File

@ -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 /error.html;
location = /error.html {
add_header Content-Type text/html;
return 200 '<meta http-equiv="refresh" content="1; URL=http://randomsec.projektstudencki.pl/" />';
}
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;
}

View File

@ -1,11 +1,14 @@
worker_processes 1; user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events { events {
worker_connections 1024; worker_connections 768;
# multi_accept on;
} }
http { http {
## ##
# Basic Settings # Basic Settings
## ##
@ -27,8 +30,8 @@ http {
# SSL Settings # SSL Settings
## ##
ssl_protocols TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE # ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on; # ssl_prefer_server_ciphers on;
## ##
# Logging Settings # Logging Settings