Skip to content

Instantly share code, notes, and snippets.

@lookingcloudy
Last active October 6, 2018 15:38
Show Gist options
  • Save lookingcloudy/7f4b928a80a2ed8ea9ee to your computer and use it in GitHub Desktop.
Save lookingcloudy/7f4b928a80a2ed8ea9ee to your computer and use it in GitHub Desktop.
nginx configuration for owncloud running on OMV
* Owncloud
- Install mysql manually:
- apt-get install mysql
- create root password during installation
- Create owncloud database and user:
- mysql -u root -p
- create database owncloud;
- create user 'owncloud@localhost' identified by 'use your own password';
- GRANT ALL PRIVILEGES ON owncloud.* TO 'owncloud'@'localhost' IDENTIFIED BY 'password';
- exit;
- Install the repository:
- References:
- follow instructions from: http://software.opensuse.org/download.html?project=isv:ownCloud:community&package=owncloud
- add the key for the repo in the same link
- Add key:
wget http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_7.0/Release.key
apt-key add - < Release.key
- Add repository:
echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/Debian_7.0/ /' >> /etc/apt/sources.list.d/owncloud.list
- Override OMV source settings
- nano /etc/apt/preferences.d/openmediavault.pref
- Append the following:
Package: owncloud
Pin: origin download.opensuse.org
Pin-Priority: 996
- Install owncloud and all dependencies
apt-get update
apt-get upgrade -y
apt-get install owncloud -y
- Create a certificate using OVM interface
- be sure to set the common name to the name used to access your site externally
- make a note of the full path/name of the .crt file: /etc/ssl/certs/*.crt -> used in configuration below
- make a note of the full path/name of the .key file: /etc/ssl/private/*.key -> used below
- Configure nginx
cd /etc/nginx/sites-enabled
wget https://gist.githubusercontent.com/sfguy/7f4b928a80a2ed8ea9ee/raw/ff7c5e3d2f68c3f8a7707f7a7b30fae53f8635e8/owncloud-omv
- Edit this file and replace the ssl certificate & key generated above
- nano owncloud-omv
service nginx restart
- navigate to your new webpage
- https://localhost:8443
- create a new admin user/passowrd -> can be anything you choose
- Choose mysql and enter the credentials you created above
- use a shared folder created in OMV
# the following are used only if you are pointing to a btsync folder and need to grant access
- sudo usermod -a -G www-data btsync
- sudo chmod -R 770 /media/UUID/btsync
## NGINX Configuration file for owncloud 7 running on Open Media Vault version 1
server {
listen [::]:8443 default_server ipv6only=off ssl deferred;
ssl_certificate /etc/ssl/certs/openmediavault-bcdd5585-47e8-4bc3-a069-b3e21bbcee7e.crt;
ssl_certificate_key /etc/ssl/private/openmediavault-bcdd5585-47e8-4bc3-a069-b3e21bbcee7e.key;
server_name owncloud;
root /var/www/owncloud;
index index.php;
autoindex off;
server_tokens off;
sendfile on;
large_client_header_buffers 4 32k;
client_max_body_size 10G;
error_log /var/log/nginx/owncloud_error.log error;
access_log /var/log/nginx/owncloud_access.log combined;
rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
location = /robots.txt {
return 200 "User-agent: *\nDisallow: /";
#allow all;
#log_not_found off;
#access_log off;
}
location ~ ^/(data|config|\.ht|db_structure\.xml|README) {
deny all;
}
location / {
# The following 2 rules are only needed with webfinger
rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
try_files $uri $uri/ index.php;
}
location ~ ^(.+?\.php)(/.*)?$ {
try_files $1 = 404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$1;
fastcgi_param PATH_INFO $2;
fastcgi_param HTTPS on;
fastcgi_param PHP_VALUE "upload_tmp_dir = /media/cecf6c18-b2e6-4099-b612-3c28d34d9474/btsync/";
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_buffers 64 4K;
}
location ~* ^.+\.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
access_log off;
}
# PFS (Perfect Forward Secrecy)
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+RC4:EECDH:EDH+aRSA:RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment