69 lines
1.6 KiB
Plaintext
69 lines
1.6 KiB
Plaintext
upstream reftest {
|
|
server app:5000;
|
|
}
|
|
|
|
server {
|
|
server_name domain_name;
|
|
listen 80 default_server;
|
|
listen [::]:80 default_server;
|
|
# Redirect to ssl
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
server {
|
|
server_name domain_name;
|
|
listen 443 ssl http2 default_server;
|
|
listen [::]:443 ssl http2 default_server;
|
|
|
|
# SSL configuration
|
|
include /etc/nginx/ssl.conf;
|
|
include /etc/nginx/certbot-challenge.conf;
|
|
|
|
# Define locations for static files to be served by Nginx
|
|
location ^~ /quiz/static/ {
|
|
include /etc/nginx/mime.types;
|
|
alias /usr/share/nginx/html/quiz/static/;
|
|
}
|
|
|
|
location ^~ /admin/static/ {
|
|
include /etc/nginx/mime.types;
|
|
alias /usr/share/nginx/html/admin/static/;
|
|
}
|
|
|
|
location ^~ /admin/editor/static/ {
|
|
include /etc/nginx/mime.types;
|
|
alias /usr/share/nginx/html/admin/editor/static/;
|
|
}
|
|
|
|
location ^~ /admin/view/static/ {
|
|
include /etc/nginx/mime.types;
|
|
alias /usr/share/nginx/html/admin/view/static/;
|
|
}
|
|
|
|
# Proxy to the main app for all other requests
|
|
location / {
|
|
include /etc/nginx/conf.d/proxy_headers.conf;
|
|
proxy_pass http://reftest;
|
|
}
|
|
}
|
|
|
|
server {
|
|
server_name www.domain_name;
|
|
listen 80;
|
|
listen [::]:80;
|
|
# Redirect to non-www
|
|
return 301 $scheme://domain_name$request_uri;
|
|
}
|
|
|
|
server {
|
|
server_name www.domain_name;
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
|
|
# SSL configuration
|
|
include /etc/nginx/ssl.conf;
|
|
include /etc/nginx/certbot-challenge.conf;
|
|
|
|
# Redirect to non-www
|
|
return 301 $scheme://domain_name$request_uri;
|
|
} |