Moving from HTTP to HTTPS under nginx generates error (freenas 11.3, iocage, nginx)

Joined
Aug 22, 2020
Messages
13
I installed a fresh and working nextcloud instance. Now I want, to connect the system with https and forward http to https...
I change following file
Code:
/usr/local/etc/nginx/nginx.conf
by inserting:
Code:
server {
    listen 80;
    server_name 192.168.0.xx;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl;
    server_name 192.168.0.xx;
    # redirects www to non-www. wasn't work for me without this server block
    # return 301 $scheme://192.168.0.xx$request_uri;
    # ssl on;
    ssl_certificate /root/cert/192.168.0.xx.crt;
    ssl_certificate_key /root/cert/192.168.0.xx.key;
    ssl_prefer_server_ciphers on;
    add_header Strict-Transport-Security "max-age=31536000" always;
}


After that, I on my browsers I receive
Code:
403 Forbidden
nginx

Do you have some hints? Without the forwarding to 443 works fine...
 
Top