GNU/Linux >> Linux の 問題 >  >> Ubuntu

Ubuntu20.04LTSにDokuWikiをインストールする方法

DokuWikiは、PHPで記述された、無料のオープンソースで最も用途の広いウィキアプリケーションです。シンプルなファイル形式を使用してデータを保存するシンプルで軽量なため、データベースは必要ありません。クリーンで読みやすい構文で知られており、多くの高度な機能を使用して簡単にスケーリングおよび最適化できます。サーバーにコンテンツをアップロードするだけで、個人またはビジネスのWebサイトを作成できます。 WYSIWYGサポート、SEO対応、組み込みのアクセス制御、認証コネクタ、柔軟なCSSフレームワークなど、豊富な機能セットが付属しています。

このチュートリアルでは、Ubuntu20.04にApacheおよびLetsencryptSSL証明書を使用してDokuWikiをインストールする方法を示します。

前提条件
  • Ubuntu20.04を実行しているサーバー。
  • サーバーで指定された有効なドメイン名。
  • ルートパスワードはサーバーで構成されています。
システムパッケージを更新する

開始する前に、システムパッケージを最新バージョンに更新することをお勧めします。次のコマンドで実行できます:

apt-get update -y
apt-get upgrade -y

システムが更新されたら、システムを再起動して変更を実装します。

ApacheとPHPをインストールする

DokuWikiはPHPで記述されており、Webサーバー上で実行されます。そのため、Apache Webサーバー、PHP、およびその他のPHPライブラリをシステムにインストールする必要があります。次のコマンドを実行して、それらすべてをインストールできます。

apt-get install apache2 php php-gd php-xml php-json -y

すべてのパッケージがインストールされたら、Apacheサービスを開始し、次のコマンドを使用して起動時に開始できるようにします。

systemctl start apache2
systemctl enable apache2

完了したら、次のステップに進むことができます。

DokuWikiをダウンロード

まず、DokuWikiの公式ダウンロードページに移動し、次のコマンドを使用してDokuWikiの最新バージョンをダウンロードします。

wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-rc.tgz

ダウンロードが完了したら、Apache Webルートディレクトリ内にDokuWikiディレクトリを作成し、DokuWikiを抽出します。

mkdir /var/www/html/dokuwiki
tar -xvzf dokuwiki-rc.tgz -C /var/www/html/dokuwiki/ --strip-components=1

次に、次のコマンドを使用してサンプルの.htaccessファイルをコピーします。

cp /var/www/html/dokuwiki/.htaccess{.dist,}

次に、dokuwikiの所有権をwww-dataに変更します:

chown -R www-data:www-data /var/www/html/dokuwiki

終了したら、次のステップに進むことができます。

DokuWiki用にApacheを構成する

次に、DokuWikiWebサイトにサービスを提供するApache仮想ホスト構成ファイルを作成します。

nano /etc/apache2/sites-available/dokuwiki.conf

次の行を追加します:

<VirtualHost *:80>
        ServerName    dokuwiki.linuxbuz.com      
        DocumentRoot  /var/www/html/dokuwiki

        <Directory ~ "/var/www/html/dokuwiki/(bin/|conf/|data/|inc/)">
            <IfModule mod_authz_core.c>
                AllowOverride All
                Require all denied
            </IfModule>
            <IfModule !mod_authz_core.c>
                Order allow,deny
                Deny from all
            </IfModule>
        </Directory>

        ErrorLog   /var/log/apache2/dokuwiki_error.log
        CustomLog  /var/log/apache2/dokuwiki_access.log combined
</VirtualHost>

終了したら、ファイルを保存して閉じます。次に、DokuWikiサイトを有効にし、次のコマンドを使用してApacheサービスをリロードします。

a2ensite dokuwiki.conf
systemctl reload apache2

この時点で、ApacheWebサーバーはDokuWikiサイトにサービスを提供するように構成されています。これで、Let'sEncryptSSLをWebサイトにインストールできます。

SSLを暗号化してLet'sで安全なDokuWiki

まず、システムにCertbotクライアントをインストールする必要があります。 Certbotは使いやすいクライアントであり、EFF、Mozillaなどによって起動されたオープンな認証局であるLet's Encryptから証明書を取得し、それをウェブサーバーにデプロイします。 Certbot Let's Encryptクライアントを使用すると、ドメインのSSL証明書を簡単にダウンロード、インストール、更新できます。

次のコマンドでCertbotをインストールできます:

apt-get install certbot python3-certbot-apache -y

Certbotクライアントが正常にインストールされたら、次のコマンドを実行して、WebサイトにLet'sEncryptSSLをインストールします。

certbot --apache -d dokuwiki.linuxbuz.com

以下に示すように、有効なメールアドレスを提供し、利用規約に同意するよう求められます。

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y

Obtaining a new certificate
Performing the following challenges:
http-01 challenge for dokuwiki.linuxbuz.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/dokuwiki-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/dokuwiki-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/dokuwiki-le-ssl.conf

次に、次の出力に示すように、HTTPトラフィックをHTTPSにリダイレクトするか、すべてのトラフィックを安全なHTTPSアクセスにリダイレクトするようにNginxを構成するかを選択します。

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

2と入力します Enterキーを押して、プロセスを開始します。インストールが完了すると、次の出力が表示されます。

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/dokuwiki.conf to ssl vhost in /etc/apache2/sites-available/dokuwiki-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://dokuwiki.linuxbuz.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=dokuwiki.linuxbuz.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/dokuwiki.linuxbuz.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/dokuwiki.linuxbuz.com/privkey.pem
   Your cert will expire on 2020-09-05. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

この時点で、DokuwikiサイトはLet'sEncryptSSLで保護されています。これで、HTTPSプロトコルを使用してサイトに安全にアクセスできます。

DokuWikiにアクセスする

次に、Webブラウザーを開き、URLhttps://dokuwiki.linuxbuz.com/install.phpを入力します。 DokuWikiのインストール画面が表示されます:

ウィキネーム、管理者ユーザー名、パスワード、メールアドレスを入力し、ポリシーを選択して、保存をクリックします。 ボタン。次のページにリダイレクトされます:

新しいDokuWiki」をクリックします "。次の​​画面が表示されます:

ログインをクリックします ボタン。以下に示すように、DokuWikiのログイン画面にリダイレクトされます。

管理者のユーザー名とパスワードを入力し、ログをクリックします ボタン。次の画面にDokuWikiダッシュボードが表示されます。

Let'sEncryptのSSL証明書の自動更新の設定

デフォルトでは、Let’sEncrypt証明書は90日間有効です。そのため、SSL証明書を自動更新するためのcronジョブを設定する必要があります。毎週または毎日実行するcronジョブを作成しても安全です。

SSL証明書を手動で更新する場合は、次のコマンドを実行します。

certbot renew --dry-run

次のファイルを編集することにより、毎日午前10時にSSL証明書を自動更新するようにcronジョブを設定できます。

crontab -e

次の行を追加します:

00 10 * * *   root /usr/bin/certbot renew >/dev/null 2>&1

終了したら、ファイルを保存して閉じます。

結論

おめでとう!これで、DokuWikiが正常にインストールされ、Ubuntu20.04でLet'sEncryptSSLを使用して保護されました。テーマ、プラグイン、テンプレートを使用してDokuWikiを拡張することもできます。ご不明な点がございましたら、お気軽にお問い合わせください。


Ubuntu
  1. Ubuntu 22.04 /20.04LTSにDockerをインストールする方法

  2. Ubuntu20.04LTSにPlayOnLinuxをインストールする方法

  3. Ubuntu20.04LTSにDokuwikiをインストールします

  1. Ubuntu20.04LTSにMariaDBをインストールする方法

  2. Ubuntu 20.04 LTS/21.04にAnsibleをインストールする方法

  3. Ubuntu 20.04 LTS/21.04にMinikubeをインストールする方法

  1. Ubuntu18.04LTSにSpotifyをインストールする方法

  2. Ubuntu18.04LTSにPrometheusをインストールする方法

  3. Ubuntu18.04LTSにDokuWikiをインストールする方法