A
A
Andrew2018-12-21 17:54:56
FreeNAS
Andrew, 2018-12-21 17:54:56

How to set up HTTPS for Nextcloud on FreeNAS?

How to set up HTTPS for Nextcloud on FreeNAS?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri008, 2020-07-27
@Yuri008

To set up HTTPS for more secure access so passwords are not sent in plain text, you will need to go to your Jails Nextcloud console and create an SSL key. On the command line, create a directory for your SSL keys, and then go there:
mkdir -p /usr/local/etc/ssl/nginx
cd /usr/local/etc/ssl/nginx
Generate an SSL key:
openssl req -x509 -nodes - days 3650 -newkey rsa:4096 -keyout nextcloud.key -out nextcloud.crt
Next, you will be prompted to enter data for association with your server, you can enter any characters. First, they will offer to enter the designation of the country, region, city. To successfully generate the key, you must complete the data entry.
Set attributes for the key file:
chmod 400 /usr/local/etc/ssl/nginx/nextcloud.key
Next, let's move on to editing the configuration files.
Edit nginx config using any available way via console, I use ee editor : ee
/usr/local/etc/nginx/nginx.conf
after lines:
# Basic settings
# ———-

insert the following lines:
server {
listen 80;
listen[::]:80;
server_name [server name];
return 301 https://$server_name$request_uri ;
}

replace [server name] with the name of your Nextcloud server. So that you get a string like this:
server_name nextcloud.somedomain.org
I made the key several times and entered different server names, the result is the same, I don’t know how it works.
Edit Nextcloud config:
ee /usr/local/etc/nginx/conf.d/nextcloud.conf
The following lines:
server {
listen 80;
server_name_;

replace with the lines:
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name[servername];
ssl_certificate /usr/local/etc/ssl/nginx/nextcloud.crt;
ssl_certificate_key /usr/local/etc/ssl/nginx/nextcloud.key;
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";

Be sure to save the files when you exit editing, for ee you need to press ESC, then a , again a . Restart Nextcload jail/plugin and login using https://

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question