差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
dokuwiki [2016/09/22 23:20] – mumeiyamibito | dokuwiki [2018/11/16 18:59] (現在) – [サーバのインストール (nginx 編)] mumeiyamibito | ||
---|---|---|---|
行 1: | 行 1: | ||
====== DokuWiki ====== | ====== DokuWiki ====== | ||
===== インストール方法 ===== | ===== インストール方法 ===== | ||
+ | ==== サーバのインストール (nginx 編) ==== | ||
+ | - nginx をインストールする。\\ <code bash> | ||
+ | $ sudo add-apt-repository ppa: | ||
+ | $ sudo apt update | ||
+ | $ sudo apt install nginx php-fpm</ | ||
+ | * [[https:// | ||
+ | - 自動起動設定する。\\ <code bash>$ sudo systemctl enable nginx</ | ||
+ | - 設定ファイルを編集する。\\ <code bash>$ sudoedit / | ||
+ | * 【追記】エラーページで nginx のバージョンを表示しない。\\ < | ||
+ | * [[https:// | ||
+ | * 【変更】ルートディレクトリを必要に応じて変更する。\\ < | ||
+ | * 【変更】エラーページを dokuwiki のエラーページに変更する\\ < | ||
+ | location / { | ||
+ | # First attempt to serve request as file, then | ||
+ | # as directory, then fall back to displaying a 404. | ||
+ | try_files $uri $uri/ @dokuwiki; | ||
+ | }</ | ||
+ | * 【追記】URL 書き換えなどの設定を追記する。\\ < | ||
+ | #Remember to comment the below out when you're installing, and uncomment it when done. | ||
+ | location ~ / | ||
+ | |||
+ | location ~ ^/ | ||
+ | expires 365d; | ||
+ | } | ||
+ | |||
+ | location @dokuwiki { | ||
+ | # rewrites " | ||
+ | rewrite ^/ | ||
+ | rewrite ^/ | ||
+ | rewrite ^/ | ||
+ | rewrite ^/(.*) / | ||
+ | } | ||
+ | location ~ \.php$ { | ||
+ | try_files $uri $uri/ /doku.php; | ||
+ | include fastcgi_params; | ||
+ | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
+ | fastcgi_param REDIRECT_STATUS 200; | ||
+ | fastcgi_pass unix:/ | ||
+ | # fastcgi_pass unix:/ | ||
+ | }</ | ||
+ | * [[https:// | ||
+ | - 以下の内容の dokuwiki のトップディレクトリにて .htaccess を新規作成する (URL の区切り文字をスラッシュにする場合に必要)。\\ <code bash>$ sudoedit .htaccess</ | ||
+ | <Files ~ " | ||
+ | Order allow,deny | ||
+ | Deny from all | ||
+ | </ | ||
+ | |||
+ | RewriteEngine on | ||
+ | RewriteRule ^_media/ | ||
+ | RewriteRule ^_detail/ | ||
+ | RewriteRule ^_export/ | ||
+ | RewriteRule ^$ doku.php | ||
+ | RewriteCond %{REQUEST_FILENAME} | ||
+ | RewriteCond %{REQUEST_FILENAME} | ||
+ | RewriteRule (.*) doku.php? | ||
+ | RewriteRule ^index.php$ | ||
+ | |||
+ | RewriteBase / # sub.example.com | ||
+ | # | ||
+ | # | ||
+ | </ | ||
+ | * [[https:// | ||
+ | - nginx の再起動をする。\\ <code bash>$ sudo systemctl restart nginx</ | ||
+ | - 場合によっては php7.0 の再起動も必要かもしれない。\\ < | ||
+ | * その他トラブルシューティング | ||
+ | * ブラウザでアクセスすると php ファイルがダウンロードされる。 | ||
+ | * 原因: ''/ | ||
+ | * ログファイルとか見て、修正する。 | ||
+ | * 原因: 誤った nginx の設定をブラウザがキャッシュしている。 | ||
+ | * 解決法: ブラウザのキャッシュを消去するか、別のブラウザでどうぞ。 | ||
+ | * 参考サイト: | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | |||
+ | ==== dokuwiki 本体のインストール ==== | ||
- サーバ環境の確認 | - サーバ環境の確認 | ||
* apache や lighttpd、nginx、Abyss などの web サーバ環境 | * apache や lighttpd、nginx、Abyss などの web サーバ環境 | ||
行 21: | 行 96: | ||
- ウェブ上から install.php にアクセス (パーミッションが不足しているとここで注意される) | - ウェブ上から install.php にアクセス (パーミッションが不足しているとここで注意される) | ||
- 必要事項を入力して、Wiki ライフをスタート | - 必要事項を入力して、Wiki ライフをスタート | ||
+ | |||
===== 既存データの移行 ===== | ===== 既存データの移行 ===== | ||
行 63: | 行 139: | ||
* Google Analytics Plugin (Dokuwiki に Google analytics を導入するプラグイン)\\ 参考サイト: | * Google Analytics Plugin (Dokuwiki に Google analytics を導入するプラグイン)\\ 参考サイト: | ||
* tag (ページをタグ付けするプラグイン)\\ 参考サイト: | * tag (ページをタグ付けするプラグイン)\\ 参考サイト: | ||
+ | * Bookmark (任意の場所にアンカーを作るプラグイン) | ||
+ | * Anchor というプラグインもあるが、なぜか動かないので、同じ機能をもつこのプラグインを導入した | ||
+ | * 公式サイト: | ||
===== ロゴや favicon の変更 ===== | ===== ロゴや favicon の変更 ===== | ||
行 74: | 行 153: | ||
===== Ubuntu 16.04 に移行した際に表示されない ===== | ===== Ubuntu 16.04 に移行した際に表示されない ===== | ||
- | * / | + | * / |
* 参考サイト: | * 参考サイト: | ||
* 解決方法\\ <code bash>$ sudo apt-get install php7.0-xml</ | * 解決方法\\ <code bash>$ sudo apt-get install php7.0-xml</ |