方法
owncloudの入れ方には,大きく分けて2種類
- apt-getで入れる
- 普通に入れる
- backportsから入れる
- ソースからコンパイル
ついでに,owncloudはwebdavが必要になるので,httpdも入れる.
- apache2
- nginx
で,本記事では
- apt-get で backportsから owncloudを入れる (apache2を使いたくないから)
- nginx で運用する
手順
- nginxと,mysql or mariadbは使える前提
- owncloudを入れてみる
-
sudo apt-get install owncloud
- なんか apache2 が入ってきたものの,nginx で十分なので backports で入れることにする
echo 'deb http://ftp.jp.debian.org/debian/ jessie-backports main contrib non-free' | sudo tee -a /etc/apt/sources.list sudo apt-get update; sudo apt-get upgrade sudo apt-get -t jessie-backports install owncloud
-
- apache2とかを消す
- 普通に消そうとすると,php5-cgiが入ろうとする.これも要らない.php5-cgiも消そうとしたら,php5-fpmが入ろうとする.これは使う.
sudo apt-get remove apache2 php5-cgi
- 他に一緒に入ったものをまとめて消す
sudo apt-get autoremove
- spdyでも良ければ,これでOK
http2を使う場合は,nginxとopensslもbackportsで入れる
- 普通に消そうとすると,php5-cgiが入ろうとする.これも要らない.php5-cgiも消そうとしたら,php5-fpmが入ろうとする.これは使う.
- mysqlの設定
- DB作成.owncloudにログインする時に初期設定するので,何でもOK.ユーザも別で作って良い.
- nginxの設定
- 基本はnginx Example Configurations — ownCloud 9.2 Server Administration Manual 9.2 documentationに従いつつ,Generate Mozilla Security Recommended Web Server Configuration Filesあたりを参照して,自分の環境に直す.
私の場合,-upstream php-handler { - server 127.0.0.1:9000; - #server unix:/var/run/php5-fpm.sock; -} - server { listen 80; - server_name cloud.example.com; # enforce https return 301 https://$server_name$request_uri; } server { - listen 443 ssl; - server_name cloud.example.com; + listen 443 http2; + server_name YOURDOMAINNAME; - ssl_certificate /etc/ssl/nginx/cloud.example.com.crt; - ssl_certificate_key /etc/ssl/nginx/cloud.example.com.key; + ssl on; + + # certs sent to the client in SERVER HELLO are concatenated in ssl_certificate + ssl_certificate /path/to/certificate/file; + ssl_certificate_key /path/to/certificate/key/file; + ssl_session_timeout 1d; + ssl_session_cache shared:SSL:50m; + ssl_session_tickets off; + + + # modern configuration. tweak to your needs. + ssl_protocols TLSv1.2; + ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256'; + ssl_prefer_server_ciphers on; + + # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months) + add_header Strict-Transport-Security max-age=15768000; + + # OCSP Stapling --- + # fetch OCSP records from URL in ssl_certificate and cache them + ssl_stapling on; + ssl_stapling_verify on; # Add headers to serve security related headers # Before enabling Strict-Transport-Security headers please read into this topic first. @@ -83,7 +97,9 @@ fastcgi_param HTTPS on; fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice fastcgi_param front_controller_active true; - fastcgi_pass php-handler; + fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_index index.php; fastcgi_intercept_errors on; fastcgi_request_buffering off; #Available since nginx 1.7.11 }
- 基本はnginx Example Configurations — ownCloud 9.2 Server Administration Manual 9.2 documentationに従いつつ,Generate Mozilla Security Recommended Web Server Configuration Filesあたりを参照して,自分の環境に直す.
- あと,この辺も設定しておかないとwebdavで大容量ファイルの転送に失敗すると思われる. nginx + php-fpmでphpを動かす - Qiita
要するにファイルサイズの上限解除.