48 lines
1.2 KiB
Plaintext
48 lines
1.2 KiB
Plaintext
# - - - - - - - - - - - - - - - - - - -
|
|
# configuration of op.fo / frode klevstul
|
|
# - - - - - - - - - - - - - - - - - - -
|
|
|
|
# enforce ssl and bare domain (without www) for http requests
|
|
# ($server_name will return the first value given)
|
|
server {
|
|
listen 80;
|
|
server_name op.fo www.op.fo;
|
|
return 301 https://$server_name$request_uri;
|
|
}
|
|
|
|
# www to bare domain for https requests
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
|
|
ssl_certificate /etc/nginx/acme.sh/op.fo/fullchain.pem;
|
|
ssl_certificate_key /etc/nginx/acme.sh/op.fo/key.pem;
|
|
ssl_trusted_certificate /etc/nginx/acme.sh/op.fo/cert.pem;
|
|
|
|
server_name www.op.fo;
|
|
return 301 $scheme://op.fo$request_uri;
|
|
}
|
|
|
|
# hw.op.fo
|
|
server {
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
|
|
ssl_certificate /etc/nginx/acme.sh/op.fo/fullchain.pem;
|
|
ssl_certificate_key /etc/nginx/acme.sh/op.fo/key.pem;
|
|
ssl_trusted_certificate /etc/nginx/acme.sh/op.fo/cert.pem;
|
|
|
|
root /var/www/hw.op.fo;
|
|
index index.html;
|
|
server_name hw.op.fo;
|
|
|
|
# redirect 404 not found to the root
|
|
location / {
|
|
error_page 404 = @myownredirect;
|
|
}
|
|
|
|
location @myownredirect {
|
|
return 302 /;
|
|
}
|
|
}
|