目次
-
- 社内Wikiおすすめの使い方 オススメ
-
- インストール 基本
- 設定 基本
- テンプレート 基本
-
- 最初に入れるお勧めプラグイン オススメ
- プラグイン一覧 オススメ
- DokuWikiの使い方 基本
- 標準機能でのページの書き方 オススメ
-
-
-
DokuWikiを理解
DokuWikiの構築
よく確認するページ
# vi /etc/yum.repos.d/nginx.repo
以下の内容にする
[nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=0 enabled=1
# yum install nginx
PHPは、5.6以上を使いましょう
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm php5.6をインストールする場合 # yum install --enablerepo=remi,remi-php56 php-cli php-mbstring php-gd php-fpm php7.1をインストールする場合 # yum install --enablerepo=remi,remi-php71 php-cli php-mbstring php-gd php-fpm
PHPのバージョン確認 # php -v
/etc/php.ini
確認 # grep -Ev "^;|^$" php.ini バックアップ # cp -p php.ini php.ini.org 編集 # vi php.ini
[PHP] default_charset = UTF-8 short_open_tag = On upload_max_filesize = 10M post_max_size = 10M memory_limit = 128M expose_php = off #phpのバージョンを隠す [mbstring] mbstring.language = Japanese mbstring.internal_encoding = UTF-8 [Date] date.timezone = Asia/Tokyo
(PHP FastCGI Process Manager)
; RPM: apache Choosed to be able to access some dir as httpd user = nginx ; RPM: Keep a group allowed to write in log dir. group = nginx
サーバ全体の設定
http { #nginxのバージョンを隠蔽 server_tokens off;
IPで接続した時の例です。
通常の80ポートではなく、今回は10080ポートにしています。
/usr/share/nginx/html/ site1/dokuwiki/ # http://192.168.0.10:10080/site1/dokuwiki/doku.phpでアクセス site2/dokuwiki/ # http://192.168.0.10:10080/site2/dokuwiki/doku.phpでアクセス
server { listen 10080 default_server; server_name localhost 192.168.0.10; root /usr/share/nginx/html; index index.php index.html doku.php; #Basic認証 #auth_basic "Restricted"; #auth_basic_user_file /etc/nginx/htpasswd; #/dokuwiki/ rewrite ^(/dokuwiki/)_media/(.*) $1lib/exe/fetch.php?media=$2 last; rewrite ^(/dokuwiki/)_detail/(.*) $1lib/exe/detail.php?media=$2 last; rewrite ^(/dokuwiki/)_export/([^/]+)/(.*) $1doku.php?do=export_$2&id=$3 last; location /dokuwiki/ { if (!-f $request_filename) { rewrite ^(/dokuwiki/)(.*)?(.*) $1doku.php?id=$2&$3 last; rewrite ^(/dokuwiki/)$ $1doku.php last; } } location ~ .(php|html|htm)$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } location ~ ^/dokuwiki/(data|conf|bin|inc)/ { deny all; } location ~ ^/dikuwiki/lib/^((?!php).)*$ { root html/dokuwiki/lib; expires 30d; } }
ドメインごとに設定ファイルの例
/usr/share/nginx/html/test1/dokuwiki http://test1.example.com/でアクセス
server { listen 80; server_name test1.example.com; access_log /var/log/nginx/test1.access.log; error_log /var/log/nginx/test1.error.log; root /usr/share/nginx/html/test1/dokuwiki; index index.html index.php doku.php; #Basic認証 #auth_basic "Restricted"; #auth_basic_user_file /etc/nginx/htpasswd; #maximum file upload size is 4MB - change accordingly if needed client_max_body_size 4M; client_body_buffer_size 128k; rewrite ^(/)_media/(.*) $1lib/exe/fetch.php?media=$2 last; rewrite ^(/)_detail/(.*) $1lib/exe/detail.php?media=$2 last; rewrite ^(/)_export/([^/]+)/(.*) $1doku.php?do=export_$2&id=$3 last; location / { if (!-f $request_filename) { rewrite ^(/)(.*)?(.*) $1doku.php?id=$2&$3 last; rewrite ^(/)$ $1doku.php last; } } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } location ~ ^/(data|conf|bin|inc)/ { deny all; } location ~ ^/lib/^((?!php).)*$ { root html/dokuwiki/lib; expires 30d; } gzip on; gzip_types image/png image/gif image/jpeg text/javascript text/css; gzip_min_length 1000; gzip_proxied any; gunzip on; }
# nginx -t
# systemctl stop firewalld.service # systemctl start nginx.service # systemctl start php-fpm.service
# systemctl disalbe firewalld.service # systemctl enable nginx.service # systemctl enable php-fpm.service
phpが動作することを確認
<?php phpinfo(); ?>
一般向けサイト
ITエンジニア向けサイト
Portfolio
Copyright (c) 2021 DokuWikiで情報発信 All Rights Reserved.