Install NextCloud in local network

Hi! I would be like to install nextcloud in local network on my job.
OS - FreeBSD +ngnix +php +mysql +php-fpm
I have some quetions. Can you help me?

  1. Public address of my cloud will be
    What must i write in “server_name” /etc/nginx/conf.d/nextcloud.conf ?
    server {
    ** listen 80;**
    ** server_name;**
    ** return 301 https://$server_name$request_uri;**
  2. How to generate ssl certificate? What must i write for /CN= ? Name or ip?

openssl req -new -x509 -days 1461 -nodes -out cert.pem -keyout cert.key -subj "/C=RU/ST=SPb/L=SPb/O=Global Security/OU=IT /CN=nextcloudk"

Do you want to use the IP address directly or perhaps a local hostname for easier access (eg. nextlcoud.local)?

For the server_name configuration in nginx, it seems to be possible to use an IP address ( If your server is used just for Nextcloud, I’d put the Nextcloud in the default vhost, so it responds regardless which hostname is used).

The certificate question is a bit more tricky:

if you have your own domain, there are ways to obtain official certificates even for intranet webservers:

go for letsencrypt, too much browser complaining about self-signed certs.