ユーザ用ツール

サイト用ツール


50_dialy:2021:04:29

差分

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

この比較画面へのリンク

次のリビジョン
前のリビジョン
50_dialy:2021:04:29 [2021/04/29 02:03] – 作成 matsui50_dialy:2021:04:29 [2023/05/17 01:26] (現在) matsui
行 1: 行 1:
-====== 2021.04.29 Docker dokuwiki ======+====== 2021.04.29 Docker dokuwiki linuxserver ====== 
 + 
 +※[[50_dialy:2021:12:30]]こちらにも別のdokuwiki 
 + 
 +こちらのlinuxserverのdokuwikiはnginxで動きます。 
 + 
 +SSL付きのDokuwiki
  
 [[https://docs.linuxserver.io/images/docker-dokuwiki]] [[https://docs.linuxserver.io/images/docker-dokuwiki]]
 +
 +===== docker-compose.yml =====
  
 <code|docker-compose.yml> <code|docker-compose.yml>
行 7: 行 15:
 version: "2.1" version: "2.1"
 services: services:
 +  https-portal:
 +    image: steveltn/https-portal:1
 +    ports:
 +      - '80:80'
 +      - '443:443'
 +    links:
 +      - dokuwiki
 +    #restart: always
 +    restart: unless-stopped
 +    environment:
 +      DOMAINS: 'dokuwiki.fl8.jp -> http://dokuwiki'
 +      #STAGE: 'local'
 +      STAGE: 'production'
 +      #FORCE_RENEW: 'true'
 +      
   dokuwiki:   dokuwiki:
     image: ghcr.io/linuxserver/dokuwiki     image: ghcr.io/linuxserver/dokuwiki
行 16: 行 39:
     volumes:     volumes:
       - ./config:/config       - ./config:/config
-    ports: +    #  - /tmpfs:/var/caceh/nginx 
-      - 80:80 +    #ports: 
-      - 443:443 #optional+    #  - 80:80 
 +    #  - 443:443 #optional
     restart: unless-stopped     restart: unless-stopped
 </code> </code>
 +
 +
 +===== 起動 =====
 +<code>
 +# docker-compose up -d
 +</code>
 +
 +このあと下記へアクセス
 +
 +https://[hostname]/install.php
 +
 +
 +===== tmpfs =====
 +
 +tmpfsにfastcgi_cacheを置く場合、tmpfsの設定を入れる
 +
 +<code|/etc/fstab>
 +tmpfs           /tmpfs            tmpfs   defaults,size=1024m,noatime,mode=1777      0       0
 +</code>
 +
 +<code>
 +mkdir /tmpfs
 +mount /tmpfs
 +</code>
 +
 +===== X-Forwared-For =====
 +
 +https-portalからforwardされてくるので、X-Forwared-Forからアクセス元IPを取得し、real_ipとしてセットする。
 +
 +<code|config/nginx/nginx.conf>
 + set_real_ip_from   172.18.0.0/16;
 + real_ip_header     X-Forwarded-For;
 +</code>
 +
 +このX-Forwared-Forを入れないと、dockerの場合[[dokuwiki:plugin:counter]]もうまくカウントしてくれない。
 +
 +===== FastCGI cache =====
 +
 +http{}の中にfastcgi_cache_pathとfastcgi_cache_keyの記述を追加
 +<code|config/nginx/nginx.conf>
 +http {
 +    fastcgi_cache_path /var/caceh/nginx levels=1:2 keys_zone=cache-zone:30m max_size=1024M inactive=600m;
 +    fastcgi_cache_key "$scheme$request_method$host$request_uri";
 +</code>
 +
 +<code|config/nginx/site-confs/default>
 +    location ~ \.php$ {
 +        fastcgi_split_path_info ^(.+\.php)(/.+)$;
 +        # With php5-cgi alone:
 +        fastcgi_pass 127.0.0.1:9000;
 +        # With php5-fpm:
 +        #fastcgi_pass unix:/var/run/php5-fpm.sock;
 +        fastcgi_index index.php;
 +        include /etc/nginx/fastcgi_params;
 +
 + set $do_not_cache 0;
 +
 + #  -- POST or HEAD ?
 + if ($request_method != "GET") {
 + set $do_not_cache 1;
 + }
 +
 +        fastcgi_cache cache-zone;
 +        fastcgi_cache_valid 200 60m;
 +        add_header X-F-Cache $upstream_cache_status;
 +</code>
 +
 +
 +===== アクセス制限 =====
 +
 +[[#X-Forwared-For]]してあれば、real_ipで制限できる。
 +
 +<code>
 +    location / { try_files $uri $uri/ @dokuwiki; 
 +        allow xxx.xxxx.xxx.xxx;
 + deny all;
 +    }
 +</code>
 +
 +
 +
 +===== Error =====
 +
 +<code>
 +# docker-compose up -d
 +Starting dokuwiki ... error
 +
 +ERROR: for dokuwiki  Cannot start service dokuwiki: oci runtime error: container_linux.go:235: starting container process caused "process_linux.go:258: applying cgroup configuration for process caused \"Cannot set property TasksAccounting, or unknown property.\""
 +
 +
 +ERROR: for dokuwiki  Cannot start service dokuwiki: oci runtime error: container_linux.go:235: starting container process caused "process_linux.go:258: applying cgroup configuration for process caused \"Cannot set property TasksAccounting, or unknown property.\""
 +
 +ERROR: Encountered errors while bringing up the project.
 +</code>
 +
 +==== 対応 ====
 +
 +古いバージョンのsystemdにはTaskAccounting が無い
 +これは新しいsystemdにupdateすれば治る
 +
 +<code>
 +# yum update systemd
 +</code>
 +
 +
 +===== 既存環境からのコピー =====
 +
 +data、conf、tplのコピー
 +<code>
 +rsync hoge@hogehoge.com:/var/www/html/dokuwiki/data/ config/dokuwiki/data/
 +rsync hoge@hogehoge.com:/var/www/html/dokuwiki/conf/ config/dokuwiki/conf/
 +rsync hoge@hogehoge.com:/home/www/public_html/dokuwiki/lib/tpl/dokuwiki/ config/dokuwiki/lib/tpl/dokuwiki/
 +</code>
 +
 +後は、既存環境と同じ拡張機能をインストール
 +
  
 {{tag>日記 dokuwiki Docker}} {{tag>日記 dokuwiki Docker}}
50_dialy/2021/04/29.1619661799.txt.gz · 最終更新: 2021/04/29 02:03 by matsui