FreeNAS 9のJail環境でWordPressをインストールして記事の投稿までできました
Install WordPress on FreeNAS 9
http://www.rootlinks.net/2013/11/20/install-wordpress-on-freenas-9/
今回はWordPressをインストールしたJail hostに追加インストールでownCloudをインストールしてみました
ownCloud
http://owncloud.org/
以前、NAS4FreeにownCloudをインストールした記事はこちらです
Install ownCloud on NAS4Free
http://www.rootlinks.net/2013/05/04/install-owncloud-on-nas4free/
Setting ownCloud on NAS4Free
http://www.rootlinks.net/2013/05/04/setting-owncloud-on-nas4free/
ちなみにFreeNAS 9にはプラグインとしてownCloudが提供されています
こちらでインストールするのが簡単ですが、それでは面白くないので
Install DLNA/UPnP Server plugin on FreeNAS 9
http://www.rootlinks.net/2013/10/26/install-dlnaupnp-server-plugin-on-freenas-9/
Nginx,php,PHP extensions,mysqlはすでにインストール済みなのでownCloudのインストールを行います
- ownCloudのダウンロード
- 展開
- オーナーの変更
- Nginxの設定ファイル
- Nginxの再起動
- Webブラウザでアクセス
- PHP extensionsの再インストール
- php-fpm,nginx再起動
ownCloudを適当なディレクトリにダウンロードします。2013/11/21最新版はowncloud-5.0.13.tar.bz2でした
1 2 3 4 5 6 7 8 9 10 11 12 |
; html-script: false ]root@vhost:/root # cd /usr/local/src/ root@vhost:/usr/local/src # wget http://download.owncloud.org/community/owncloud-5.0.13.tar.bz2 --2013-11-21 20:55:54-- http://download.owncloud.org/community/owncloud-5.0.13.tar.bz2 Resolving download.owncloud.org (download.owncloud.org)... 50.30.33.234 Connecting to download.owncloud.org (download.owncloud.org)|50.30.33.234|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 15436770 (15M) [application/x-bzip] Saving to: 'owncloud-5.0.13.tar.bz2' 100%[======================================>] 15,436,770 284KB/s in 54s 2013-11-21 20:56:48 (281 KB/s) - 'owncloud-5.0.13.tar.bz2' saved [15436770/15436770] |
ダウンロードしたowncloud-5.0.13.tar.bz2を展開します
ownCloudはWordPressとは別にしNginxで別のポートで動作させることにします
1 |
; html-script: false ]root@vhost:/usr/local/src # tar xvfz owncloud-5.0.13.tar.bz2 -C /usr/local/www/ |
Nginxはwww:wwwで動作しているのでこのオーナーに変更します
1 |
; html-script: false ]root@vhost:/usr/local/src # chown -R www:www /usr/local/www/owncloud/ |
Nginxの設定ファイルを編集します。取り敢えず動作ポートは10080,Document Rootは/usr/local/www/owncloudです
owncloud用serverディレクティブが増えています
参考サイト
ownCloud Administrators Manual – Other Web Servers
http://doc.owncloud.org/server/5.0/admin_manual/installation/installation_others.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
; html-script: false ]root@vhost:/usr/local/src # vi /usr/local/etc/nginx/nginx.conf root@vhost:/usr/local/src # cat /usr/local/etc/nginx/nginx.conf user www www; worker_processes 4; pid /var/run/nginx.pid; error_log /var/log/nginx.error_log info; events { worker_connections 1024; use kqueue; } #http section http { include mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginxaccess.log main; sendfile on; keepalive_timeout 65; gzip on; server_names_hash_bucket_size 64; gzip_http_version 1.1; gzip_vary on; gzip_comp_level 1; gzip_min_length 1100; gzip_proxied any; gzip_types text/plain text/css application/json application/x-javascript text/x$ gzip_buffers 16 8k; gzip_disable "MSIE [1-6].(?!.*SV1)"; server { listen 80; server_name www2.rootlinks.net; root /usr/local/www/wordpress; index index.php index.html index.htm; location / { # If requested URI does not match any existing file, directory or symbolic link, rewrite the URL to index.php if (!-e $request_filename) { rewrite ^ /index.php last; } } # For all PHP requests, pass them on to PHP-FPM via FastCGI location ~ \.php$ { fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_script_name; include fastcgi_params; # include extra FCGI params } location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ { access_log off; log_not_found off; expires max; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/local/www/nginx-dist; } } server { listen 10080; server_name www2.rootlinks.net; # Path to the root of your installation root /usr/local/www/owncloud; client_max_body_size 10G; # set max upload size fastcgi_buffers 64 4K; rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect; rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect; rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect; index index.php; error_page 403 /core/templates/403.php; error_page 404 /core/templates/404.php; location = /robots.txt { 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_pass unix:/var/run/php-fpm.sock; } # Optional: set long EXPIRES header on static assets location ~* ^.+\.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ { expires 30d; # Optional: Don't log access to assets access_log off; } } } |
Nginxの再起動します
1 2 3 4 5 6 7 8 9 10 |
; html-script: false ]root@vhost:/usr/local/src # /usr/local/etc/rc.d/nginx restart Performing sanity check on nginx configuration: nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful Stopping nginx. Waiting for PIDS: 65576. Performing sanity check on nginx configuration: nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful Starting nginx. |
Webブラウザでhttp://FreeNAS9 ip:10080/でアクセスすると何やらエラーが表示されました
php zipモジュールとGDモジュールがインストールされていないとのエラーでした
そうかzipとGDは必須だったか
PHP extensionsを再インストールします。いつものようにmake configでzipとGDを追加して make install cleanを実行します
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
; html-script: false ]root@vhost:/usr/local/src # cd /usr/ports/lang/php5-extensions/ root@vhost:/usr/local/src # make config root@vhost:/usr/ports/lang/php5-extensions # make showconfig | grep =on CTYPE=on: ctype functions CURL=on: CURL support DOM=on: DOM support FILTER=on: input filter support GD=on: GD library support HASH=on: HASH Message Digest Framework ICONV=on: iconv support JSON=on: JavaScript Object Serialization support MBSTRING=on: multibyte string support MYSQL=on: MySQL database support PDO=on: PHP Data Objects Interface (PDO) PDO_SQLITE=on: PDO sqlite driver PHAR=on: phar support POSIX=on: POSIX-like functions SESSION=on: session support SIMPLEXML=on: simplexml support SQLITE3=on: sqlite3 support TOKENIZER=on: tokenizer support XML=on: XML support XMLREADER=on: XMLReader support XMLWRITER=on: XMLWriter support ZIP=on: ZIP support root@vhost:/usr/ports/lang/php5-extensions # make root@vhost:/usr/ports/lang/php5-extensions # make deinstall root@vhost:/usr/ports/lang/php5-extensions # make reinstall root@vhost:/usr/ports/lang/php5-extensions # make clean |
1 2 3 |
; html-script: false ] root@vhost:/usr/ports/lang/php5-extensions # /usr/local/etc/rc.d/php-fpm restart root@vhost:/usr/ports/lang/php5-extensions # /usr/local/etc/rc.d/nginx restart |
再度Webブラウザでアクセスすると初期設定画面が表示されました
Pingback: GeekWind » Blog Archive » やっとownCloudを導入