njpma/etc/nginx/sites-available/njp.ma

70 lines
1.7 KiB
Mathematica
Raw Permalink Normal View History

2021-10-28 18:24:19 +00:00
upstream django-backend {
server 127.0.0.1:8080;
}
server {
listen 80;
listen [::]:80;
location /.well-known/ {
root /var/www/html;
autoindex off;
}
2021-11-21 09:09:09 +00:00
rewrite ^/(.*) https://njp.ma/$1 permanent;
2021-10-28 18:24:19 +00:00
}
server {
server_tokens off;
2021-11-21 09:09:09 +00:00
server_name njp.ma;
2021-10-28 18:24:19 +00:00
listen 443 ssl http2;
listen [::]:443 ssl http2;
2021-11-21 09:09:09 +00:00
ssl_trusted_certificate /etc/letsencrypt/live/njp.ma/chain.pem;
ssl_certificate /etc/letsencrypt/live/njp.ma/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/njp.ma/privkey.pem;
2021-10-28 18:24:19 +00:00
#include /etc/letsencrypt/nginx.conf;
location /favicon.ico {
root /srv/phantasma/www/static;
}
location /media/ {
root /srv/phantasma/data/;
}
location /static/ {
root /srv/phantasma/www/;
}
location / {
root /srv/phantasma/public;
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_pass http://django-backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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;
proxy_set_header X-Forwarded-Host $server_name;
client_max_body_size 32m;
}
error_page 400 /;
error_page 404 /404.html;
location /404.html {
root /srv/phantasma/www/static/html;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location /50x.html {
root /srv/phantasma/www/static/html;
}
}