Volevo giocare con owncloud, ma non volevo la solita accoppiata mysql e apache2, ma nginx e postgresql.
Tuttavia ho dovuto mettere le mani nei file di configurazione della macchina:
owncloud non accetta versioni di php maggiori di 7, ma ubuntu 22.04 non ha più il supporto per la 7.4, ma solo la 8.1.
Ho aggiunto un repository con
sudo add-apt-repository ppa:ondrej/php -y
e poi
sudo apt-get update
sudo apt-get install nginx
seguito da un
sudo apt-get install php7.4 php7.4-fpm
sudo apt-get install php7.4-json \
php7.4-curl php7.4-imap php7.4-mcrypt \
php7.4-mcrypt php7.4-xmlrpc php7.4-zip \
php7.4-zip php7.4-pgsql php7.4-opcache \
php7.4-cli php7.4-gmp php7.0-gd \
php7.4-xml php7.4-ldap php7.4-intl php7.4-mbstring
dal sito di owncloud ho prese l’ultima versione disponibile con
wget https://download.owncloud.com/server/stable/owncloud-complete-latest.zip
quindi ho spacchetta il tutto sotto /var/www, chmlod per cambiare l’utente da root in www-data, ho aggiunto il file della configurazione del server sotto /etc/nginx/site-available
upstream php-handler {
server unix:/run/php/php7.4-fpm.sock;
}
server {
listen 80;
server_name owncloud.example.com;
# enforce https
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name owncloud.example.com;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
# Add headers to serve security related headers
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
# Path to the root of your installation
root /var/www/owncloud/;
# set max upload size
client_max_body_size 10G;
fastcgi_buffers 64 4K;
# Disable gzip to avoid the removal of the ETag header
gzip off;
# Uncomment if your server is build with the ngx_pagespeed module
# This module is currently not supported.
#pagespeed off;
index index.php;
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
rewrite ^/.well-known/carddav /remote.php/dav/ permanent;
rewrite ^/.well-known/caldav /remote.php/dav/ permanent;
# The following 2 rules are only needed for the user_webfinger app.
# Uncomment it if you're planning to use this app.
#rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
#rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ ^/(build|tests|config|lib|3rdparty|templates|data)/ {
deny all;
}
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location / {
rewrite ^/remote/(.*) /remote.php last;
rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
try_files $uri $uri/ =404;
}
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
}
# Adding the cache control header for js and css files
# Make sure it is BELOW the location ~ \.php(?:$|/) { block
location ~* \.(?:css|js)$ {
add_header Cache-Control "public, max-age=7200";
# Add headers to serve security related headers
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
# Optional: Don't log access to assets
access_log off;
}
# Optional: Don't log access to other assets
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|swf)$ {
access_log off;
}
}
Ho creato i certificati selfsigned con
sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt
sulla macchina che utilizzo come database ho creato quanto serve a owncloud
sudo su postgres
# Then lets setup `role` and create database for owncloud
postgres@userver:/home/alok$ psql
postgres=# CREATE ROLE owncloud ;
postgres=# ALTER ROLE owncloud WITH PASSWORD 'myPassword' ;
postgres=# ALTER ROLE owncloud WITH LOGIN ;
postgres=# CREATE DATABASE owncloud ;
postgres=# ALTER DATABASE owncloud OWNER TO owncloud ;
postgres=# \list
postgres=# \q
e digitando
https://owncloud.example.com (nome di fantasia)
appare la schermata per la configurazione di base di owncloud !!