ユーザ用ツール

サイト用ツール


serverapps:nextcloud

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
serverapps:nextcloud [2023/07/28 12:43] – [Nginx] hayashiserverapps:nextcloud [2023/08/26 11:39] (現在) – [nextcloud404" failed] hayashi
行 1: 行 1:
 ====== NextCloud ====== ====== NextCloud ======
-===== Install ===== 
  
-パッケージから入れようと思ってたが、某氏より「ひどい目に合うから本体だけはソースにしとけ」と言われたのもあって、そのようにしてみる+FreeBSD 13.2 上構築した記録
  
-==== 本体 ====+===== Tips ===== 
 +==== nextcloud404" failed ==== 
 +  nextcloud404" failed
  
-[[https://github.com/nextcloud/server|GitHUB]]からソースを持っきた+とlogに記録され404エラー
  
-/usr/local/wwwに展開しておく+どうやら、ヘッダのホスト名とnginxのserver名がアンマッチだと生じる模様\\ 
 +なので、localで http://localhost でアクセスしてもでる\\ 
 +http://IPアドレスだと動いたりするwww\\ 
 +===== 参考 =====
  
 +  * [[https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html|NGINX configuration]]
 +  * [[https://www.seirios.org/seirios/dokuwiki/doku.php?id=tweet:2020:1215_01&s[]=nextcloud|FreeBSD 12.1-RELEASE and NextCloud]]
 +  * [[https://www.nginx.com/resources/wiki/start/topics/examples/phpfcgi/|PHP FastCGI Example]]
  
- 
-==== 依存パッケージを調べる ==== 
- 
- 
-<code> 
-# pkg search -d nextcloud-php83 
-nextcloud-php83-27.0.0 
-Comment        : Collaboration platform which runs on your own server 
-Depends on     : 
-        php83-session-8.3.0.a2 
-        php83-opcache-8.3.0.a2 
-        php83-xsl-8.3.0.a2 
-        php83-xmlwriter-8.3.0.a2 
-        php83-xmlreader-8.3.0.a2 
-        php83-xml-8.3.0.a2 
-        php83-simplexml-8.3.0.a2 
-        php83-dom-8.3.0.a2 
-        php83-ctype-8.3.0.a2 
-        php83-posix-8.3.0.a2 
-        php83-fileinfo-8.3.0.a2 
-        php83-filter-8.3.0.a2 
-        php83-ldap-8.3.0.a2 
-        php83-gmp-8.3.0.a2 
-        php83-bcmath-8.3.0.a2 
-        php83-8.3.0.a2 
-        php83-gd-8.3.0.a2 
-        php83-exif-8.3.0.a2 
-        php83-curl-8.3.0.a2 
-        php83-sysvsem-8.3.0.a2 
-        php83-pcntl-8.3.0.a2 
-        php83-intl-8.3.0.a2 
-        php83-pecl-APCu-5.1.22 
-        gettext-runtime-0.21.1 
-        php83-pdo_mysql-8.3.0.a2 <- これは外す 
-        php83-pdo-8.3.0.a2 
-        php83-mbstring-8.3.0.a2 
-        php83-iconv-8.3.0.a2 
-        php83-zlib-8.3.0.a2 
-        php83-zip-8.3.0.a2 
-        php83-bz2-8.3.0.a2 
-</code> 
- 
-DBにはPostgreSQLを使う 
- 
-<code> 
-# pkg search -d php83-pdo_pgsql 
-php83-pdo_pgsql-8.3.0.a2 
-Comment        : The pdo_pgsql shared extension for php 
-Depends on     : 
-        php83-8.3.0.a2 
-        postgresql13-client-13.11 
-        php83-pdo-8.3.0.a2 
-</code> 
- 
-phpが13までなのでPostgreSQLは13系列を入れる\\ 
-webサーバはNginxにする 
- 
-==== php関連 ==== 
- 
- 
-という事で入れていく\\ 
-まずはphp関連 
- 
-  # pkg install php83-session php83-opcache php83-xsl php83-xmlwriter php83-xmlreader php83-xml php83-simplexml php83-dom php83-ctype php83-posix php83-fileinfo php83-filter php83-ldap php83-gmp php83-bcmath php83 php83-gd php83-exif php83-curl php83-sysvsem php83-pcntl php83-intl php83-pecl-APCu gettext-runtime php83-pdo php83-mbstring php83-iconv php83-zlib php83-zip php83-bz2 
-   
-  New packages to be INSTALLED: 
-          brotli: 1.0.9,1 
-          curl: 8.1.2 
-          cyrus-sasl: 2.1.28 
-          expat: 2.5.0 
-          fontconfig: 2.14.2,1 
-          freetype2: 2.12.1_2 
-          giflib: 5.2.1 
-          gmp: 6.2.1 
-          icu: 73.2,1 
-          jbigkit: 2.1_1 
-          jpeg-turbo: 2.1.5.1 
-          libargon2: 20190702 
-          libdeflate: 1.18 
-          libgcrypt: 1.10.2 
-          libgd: 2.3.3_5,1 
-          libgpg-error: 1.47 
-          libiconv: 1.17 
-          liblz4: 1.9.4,1 
-          libnghttp2: 1.53.0 
-          libxml2: 2.10.4 
-          libxslt: 1.1.37 
-          libzip: 1.10.0 
-          oniguruma: 6.9.8_1 
-          openldap26-client: 2.6.4 
-          pcre2: 10.42 
-          php83: 8.3.0.a2 
-          php83-bcmath: 8.3.0.a2 
-          php83-bz2: 8.3.0.a2 
-          php83-ctype: 8.3.0.a2 
-          php83-curl: 8.3.0.a2 
-          php83-dom: 8.3.0.a2 
-          php83-exif: 8.3.0.a2 
-          php83-fileinfo: 8.3.0.a2 
-          php83-filter: 8.3.0.a2 
-          php83-gd: 8.3.0.a2 
-          php83-gmp: 8.3.0.a2 
-          php83-iconv: 8.3.0.a2 
-          php83-intl: 8.3.0.a2 
-          php83-ldap: 8.3.0.a2 
-          php83-mbstring: 8.3.0.a2 
-          php83-opcache: 8.3.0.a2 
-          php83-pcntl: 8.3.0.a2 
-          php83-pdo: 8.3.0.a2 
-          php83-pecl-APCu: 5.1.22 
-          php83-posix: 8.3.0.a2 
-          php83-session: 8.3.0.a2 
-          php83-simplexml: 8.3.0.a2 
-          php83-sysvsem: 8.3.0.a2 
-          php83-xml: 8.3.0.a2 
-          php83-xmlreader: 8.3.0.a2 
-          php83-xmlwriter: 8.3.0.a2 
-          php83-xsl: 8.3.0.a2 
-          php83-zip: 8.3.0.a2 
-          php83-zlib: 8.3.0.a2 
-          png: 1.6.39 
-          readline: 8.2.1 
-          tiff: 4.4.0_1 
-          webp: 1.3.0_1 
-          zstd: 1.5.5 
-   
-  Number of packages to be installed: 59 
-   
-  The process will require 173 MiB more space. 
- 
-==== Nginx ==== 
- 
-お次に、Nginx 
- 
-  # pkg install nginx memcached php83-pdo_pgsql php83-pgsql 
-  New packages to be INSTALLED: 
-        libevent: 2.1.12 
-        memcached: 1.6.21 
-        nginx: 1.24.0_6,3 
-        php83-pdo_pgsql: 8.3.0.a2 
-        php83-pgsql: 8.3.0.a2 
-        postgresql13-client: 13.11 
-   
-  Number of packages to be installed: 14 
-   
-  The process will require 1 GiB more space 
-   
-==== PostgreSQL==== 
- 
-PostgreSQLは別マシンへ  
- 
-  # pkg install postgresql13-client postgresql13-server 
-  New packages to be INSTALLED: 
-        icu: 73.2,1 
-        libedit: 3.1.20221030,1 
-        libffi: 3.4.4 
-        liblz4: 1.9.4,1 
-        llvm15: 15.0.7_5 
-        lua53: 5.3.6 
-        mpdecimal: 2.5.1 
-        perl5: 5.32.1_3 
-        postgresql13-client: 13.11 
-        postgresql13-server: 13.11 
-        python39: 3.9.17 
-        readline: 8.2.1 
-        zstd: 1.5.5 
- 
-インストールの最後に表示されるPostgreSQL設定について 
-  * バキューム:普通Autoなのでいらんけど、独自にやりたいなら以下参照 
-    * /usr/local/etc/periodic/daily/502.pgsql 
-  * バックアップ:以下が役に立つかも 
-    * /usr/local/etc/periodic/daily/502.pgsql 
- 
-===== 設定 ===== 
-==== PostgreSQL ==== 
-=== rc.conf === 
- 
-/etc/rc.confまたは/etc/rc.conf.localに記述 
- 
-  postgresql_enable="YES" 
-  postgresql_data="/usr/local/pgsql/DATA" 
- 
-data領域はzfsで別にとるので、disk追加してpool作成 
- 
-  # zpool create zdata /dev/adaxx 
-  # zfs create -o mountpoint=/usr/local/pgsql zdata/pgsql 
-  # mkdir /usr/local/pgsql/DATA 
-  # chown postgres:postgres /usr/local/pgsql/DATA 
- 
-=== 初期化 === 
- 
- 
-<code> 
-# service postgresql initdb 
-The files belonging to this database system will be owned by user "postgres". 
-This user must also own the server process. 
- 
-The database cluster will be initialized with locales 
-  COLLATE:  C 
-  CTYPE:    C.UTF-8 
-  MESSAGES: C.UTF-8 
-  MONETARY: C.UTF-8 
-  NUMERIC:  C.UTF-8 
-  TIME:     C.UTF-8 
-The default text search configuration will be set to "english". 
- 
-Data page checksums are disabled. 
- 
-fixing permissions on existing directory /usr/local/pgsql/DATA ... ok 
-creating subdirectories ... ok 
-selecting dynamic shared memory implementation ... posix 
-selecting default max_connections ... 100 
-selecting default shared_buffers ... 128MB 
-selecting default time zone ... Japan 
-creating configuration files ... ok 
-running bootstrap script ... ok 
-performing post-bootstrap initialization ... ok 
-syncing data to disk ... ok 
- 
-initdb: warning: enabling "trust" authentication for local connections 
-You can change this by editing pg_hba.conf or using the option -A, or 
---auth-local and --auth-host, the next time you run initdb. 
- 
-Success. You can now start the database server using: 
- 
-    /usr/local/bin/pg_ctl -D /usr/local/pgsql/DATA -l logfile start 
-</code> 
- 
-=== pg_hba.conf の編集 === 
- 
-外部からの接続を /usr/local/pgsql/data/pg_hba.conf に設定します((標準では自分自身からの接続のみを許可しています)) 
- 
-  # TYPE  DATABASE        USER            CIDR-ADDRESS            METHOD 
-  host    all             all             192.168.0.0/24          md5 
- 
-postgresql.confのlisten_addresses も変更 
- 
-  listen_addresses = '*' 
- 
-=== 起動 === 
-PostgrSQLを起動 
-  # service postgresql start 
- 
-=== NextCloud用設定 === 
- 
-<code> 
-# psql -h localhost -U postgres 
-psql (13.11) 
-Type "help" for help. 
- 
-postgres=# CREATE ROLE ncadm WITH LOGIN PASSWORD 'ncadmpassword'; 
-CREATE ROLE 
-postgres=# CREATE DATABASE nc WITH OWNER ncadm TEMPLATE template0  
-postgres=# ENCODING UTF8 LC_COLLATE 'ja_JP.UTF-8' LC_CTYPE 'ja_JP.UTF-8'; 
-CREATE DATABASE 
-</code> 
- 
-==== Nginx ==== 
- 
-=== /usr/local/etc/nginx/nginx.conf === 
- 
-<file conf nginx.conf> 
-user www; 
-worker_processes auto; 
-worker_cpu_affinity auto; 
-worker_priority 0; 
- 
-worker_rlimit_nofile 51200; 
-error_log /var/log/nginx/error.log; 
- 
-events { 
-  worker_connections 1024; 
-  multi_accept        on; 
-  accept_mutex on; 
-  accept_mutex_delay  100ms;   
-} 
- 
-http { 
-  include       mime.types; 
-  include       conf.d/options; 
- 
-  default_type  application/octet-stream; 
- 
-  access_log    /var/log/nginx/access.log main; 
- 
-  upstream php-handler { 
-    server 127.0.0.1:9000; 
-  } 
- 
-</file> 
- 
-=== /usr/local/etc/nginx/conf.d/options === 
- 
- 
-<file conf options> 
-charset                   utf-8; 
-client_body_buffer_size   512k; 
-# set max upload size and increase upload timeout: 
-client_max_body_size      512M; 
-# client_body_timeout       5s; 
-client_body_timeout       300s; 
-client_header_timeout     5s; 
-gzip                      on; 
-gzip_comp_level           4; 
-gzip_disable              "MSIE [1-6]\.(?!.*SV1)"; 
-gzip_http_version         1.1; 
-gzip_min_length           512; 
-#gzip_proxied              any; 
-gzip_proxied              expired no-cache no-store private no_last_modified no_etag auth; 
-gzip_types                application/atom+xml text/javascript application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; 
-gzip_static               on; 
-#gzip_types                text/plain text/css text/javascript application/javascript text/xml application/xml application/xml+rss; 
-gzip_vary                 on; 
-ignore_invalid_headers    on; 
-keepalive_disable         none; 
-keepalive_requests        50; 
-keepalive_timeout         75s; 
-limit_req_zone            $binary_remote_addr  zone=gulag:1m   rate=60r/m; 
-log_format                main  '$remote_addr $host $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $ssl_cipher $request_time'; 
-max_ranges                1; 
-msie_padding              off; 
-open_file_cache           max=1000 inactive=2h; 
-open_file_cache_errors    on; 
-open_file_cache_min_uses  1; 
-open_file_cache_valid     1h; 
-output_buffers            1 512; 
-postpone_output           1440; 
-read_ahead                512K; 
-recursive_error_pages     on; 
-reset_timedout_connection on; 
-send_timeout              15s; 
-sendfile                  on; 
-server_name_in_redirect   off; 
-server_tokens             off; 
-source_charset            utf-8; 
-tcp_nodelay               on; 
-tcp_nopush                off; 
- 
-</file> 
  
serverapps/nextcloud.1690548180.txt.gz · 最終更新: 2023/07/28 12:43 by hayashi