====== 本站的Dokuwiki设置 ====== 本文是该wiki的安装配置说明,[[http://www.dokuwiki.org|Dokuwiki主页]]有详细的manual,这里只简要列出处理步骤。 当前操作系统是[[https://ubuntu.com/|Ubuntu 20.04]],Web服务器为[[http://www.apache.org|Apache 2.4]],Dokuwiki版本为2023-04-04a “Jack Jackrum”。 ===== 升级说明 2023-10-21 ===== ==== Dokuwiki升级 ==== 本次升级间隔了多个版本,需要依次进行。 升级到2020-07-29a "Hogfather": tar xzvf dokuwiki-2020-07-29a.tgz 'cp' -af dokuwiki-2020-07-29a/* /var/www/html/wiki/ 升级到2022-07-31b "Igor": tar xzvf dokuwiki-2022-07-31b.tgz 'cp' -af dokuwiki-2022-07-31b/* /var/www/html/wiki/ 升级到2023-04-04a "Jack Jackrum": tar xzvf dokuwiki-2023-04-04a.tgz 'cp' -af dokuwiki-2023-04-04a/* /var/www/html/wiki/ 完毕调整权限: chown -R www-data:www-data /var/www/html/wiki ==== 删除code插件 ==== 此时打不开主页,原因是[[http://www.dokuwiki.org/plugin:code2|code]]插件不兼容了,需要手工删除它: cd /var/www/html/wiki/lib/plugins rm -rf code ==== 升级其他插件 ==== 在扩展管理器里更新插件。 目前使用的插件: * Note, [[http://www.dokuwiki.org/plugin:note]] * Tag, [[http://www.dokuwiki.org/plugin:tag]] * Cloud, [[http://www.dokuwiki.org/plugin:cloud]] * Pagelist, [[http://www.dokuwiki.org/plugin:pagelist]] * Table Width, [[http://www.dokuwiki.org/plugin:tablewidth]] ===== 升级说明 2021-11-19 ===== 由于[[http://www.centos.org/|CentOS 8]]即将结束支持,故将操作系统更换为[[https://ubuntu.com/|Ubuntu 20.04]],所以重新进行了安装配置。 ==== 安装Apache和PHP ==== aptitude install apache2 aptitude install php7.4 php7.4-gd php7.4-mbstring php7.4-xml ==== 数据恢复 ==== 将原来网站的文件从旧服务器复制到新机器的/var/www/html目录下。 设置权限: cd /var/www/ chown -R root:root html chown -R www-data:www-data html/wiki ==== 配置Apache ==== 编辑/etc/apache2/sites-enabled/000-default.conf,添加: ServerName gwduan.com ServerAlias www.gwduan.com Order deny,allow Allow from all Order allow,deny Deny from all Satisfy All ==== 启用https ==== 这里使用[[https://letsencrypt.org/|Let's Encrypt]]提供的免费证书。 首先安装certbot工具: aptitude install certbot 生成证书: systemctl stop apache2 certbot certonly --standalone 根据提示为域名gwduan.com和www.gwduan.com申请证书。 启用mod_ssl: a2enmod ssl a2ensite default-ssl 编辑/etc/apache2/sites-enabled/default-ssl.conf,添加: SSLCertificateFile /etc/letsencrypt/live/gwduan.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/gwduan.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/gwduan.com/fullchain.pem Order deny,allow Allow from all Order allow,deny Deny from all Satisfy All 编辑/etc/apache2/sites-enabled/000-default.conf,定向到https: ... Redirect permanent / https://www.gwduan.com/ 编辑/etc/cron.d/certbot,增加pre-hook和post-hook参数: certbot -q renew --pre-hook 'systemctl stop apache2' --post-hook 'systemctl start apache2' ===== 升级说明 2019-07-13 ===== 由于更换了服务器,操作系统升级为[[http://www.centos.org/|CentOS 7]],所以重新进行了安装配置。相应的升级到Apache 2.4和php 7.2,Dokuwiki版本升级到2018-04-22b "Greebo"。 ==== 安装Apache和PHP ==== 启用scl源: yum install centos-release-scl 安装Apache和PHP: yum install httpd24 yum install rh-php72 rh-php72-php rh-php72-php-gd \ rh-php72-php-mbstring rh-php72-php-xml 启用服务: systemctl enable httpd24-httpd systemctl start httpd24-httpd ==== 数据恢复 ==== 将原来网站的文件从旧服务器复制到新机器的/opt/rh/httpd24/root/var/www/html目录下。 设置权限: cd /opt/rh/httpd24/root/var/www/ chown -R root:root html chown -R apache:apache html/wiki ==== 配置Apache ==== 编辑/opt/rh/httpd24/root/etc/httpd/conf/httpd.conf,添加: Order deny,allow Allow from all Order allow,deny Deny from all Satisfy All DocumentRoot "/opt/rh/httpd24/root/var/www/html" ServerName gwduan.com ServerAlias www.gwduan.com ==== 升级Dokuwiki ==== 升级到2018-04-22b "Greebo": tar xzvf dokuwiki-8a269cc015a64b40e4c918699f1e1142.tgz 'cp' -af dokuwiki/* wiki/ 设置权限: chown -R apache:apache wiki/ chmod -R o-rwx wiki/ ==== Plugin插件升级 ==== 在扩展管理器里更新各个插件。 ==== 启用https ==== 这里使用[[https://letsencrypt.org/|Let's Encrypt]]提供的免费证书。 首先安装certbot工具(需要EPEL源): yum install certbot 由于Apache没有安装在标准位置上,所以不使用certbot的Apache插件,而只是生成证书: systemctl stop httpd24-httpd certbot certonly --standalone 根据提示为域名gwduan.com和www.gwduan.com申请证书。 安装mod_ssl: yum install httpd24-mod_ssl 编辑/opt/rh/httpd24/root/etc/httpd/conf.d/ssl.conf,设置: SSLCertificateFile /etc/letsencrypt/live/gwduan.com/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/gwduan.com/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/gwduan.com/fullchain.pem 编辑/opt/rh/httpd24/root/etc/httpd/conf/httpd.conf,定向到https: ... Redirect permanent / https://www.gwduan.com/ 编辑/etc/crontab,增加自动更新证书的任务: 0 0,12 * * * root python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew --pre-hook 'systemctl stop httpd24-httpd' --post-hook 'systemctl start httpd24-httpd' >> /var/log/certbot.log 2>&1 ===== 升级说明 2017-09-10 ===== 操作系统依旧基于[[http://www.centos.org/|CentOS 6]],Web服务器升级为[[http://www.apache.org|Apache 2.4]],Dokuwiki版本升级为2017-02-19e "Frusterick Manners"。 ==== 升级Apache和PHP ==== 新的Dokuwiki要求PHP 5.6以上,所以需要先升级Apache和PHP。 启用scl源: yum install centos-release-scl 安装新版本的Apache和PHP: yum install httpd24 yum install rh-php56 rh-php56-php 启用新服务: chkconfig httpd off chkconfig httpd24-httpd on ==== Apache配置调整 ==== 新的Apache目录发生了改变,所以需要做相应调整。 编辑/opt/rh/httpd24/root/etc/httpd/conf/httpd.conf,添加: Order deny,allow Allow from all Order allow,deny Deny from all Satisfy All ==== Dokuwiki升级 ==== 首先将原来的wiki文件复制到新位置: cd /opt/rh/httpd24/root/var/www/html cp -pr /var/www/html/* . 由于间隔了多个版本,需要依次升级。 升级到2015-08-10a “Detritus”: tar xzvf dokuwiki-2015-08-10.tgz 'cp' -af dokuwiki-2015-08-10/* wiki/ 升级到2016-06-26e “Elenor of Tsort”: tar xzvf dokuwiki-2016-06-26.tgz 'cp' -af dokuwiki-2016-06-26/* wiki/ 升级到2017-02-19e “Frusterick Manners”: tar xzvf dokuwiki-2017-02-19.tgz 'cp' -af dokuwiki-2017-02-19/* wiki/ 最后调整权限: chown -R apache:apache wiki/ chmod -R o-rwx wiki/ ==== Plugin插件升级 ==== 在扩展管理器里更新各个插件。 ===== 初始安装 ===== 操作系统基于[[http://www.centos.org/|CentOS 6]],Web服务器为Apache 2.2,Dokuwiki版本为2014-05-05a "Ponder Stibbons"。 ==== web服务器配置 ==== 为了安全性,对Dokuwiki的几个关键目录进行设置。 在/etc/httpd/conf/httpd.conf末尾添加: Order deny,allow Allow from all Order allow,deny Deny from all Satisfy All 有关Dokuwiki安全方面的详细说明,可参阅[[http://www.dokuwiki.org/security]]。 ==== Dokuwiki安装 ==== === 解包 === wiki程序安装在web服务器目录/var/www/html下,并将文件权限归属为web服务器进程用户(apache): cd /var/www/html tar xzf dokuwiki-*.tgz mv dokuwiki wiki chown -R apache:apache wiki/ chmod -R o-rwx wiki/ 有关Dokuwiki权限方面的详细说明,可参阅[[http://www.dokuwiki.org/install:permissions]]。 === 初始配置 === 通过浏览器运行install.php,进行初始配置,包括设置语言、wiki名称、管理员帐户、wiki类型、license等。 完毕以管理员帐户登录,添加一个日常应用的普通帐户;设置目录权限为0750,文件权限为0640;由于是个人wiki,关闭注册功能。 ==== Template模板设置 ==== 有关模板的详细说明,可参阅[[http://www.dokuwiki.org/Template]]。 这里直接使用缺省的模板。 ==== Plugin插件设置 ==== Dokuwiki提供了丰富的插件,有关插件的详细说明,可参阅[[http://www.dokuwiki.org/plugins]]。 插件通过扩展管理器直接安装。 安装完毕,若插件没有效果,则更新下缓存: touch /var/www/html/wiki/conf/local.php 有关缓存问题的详细说明在:[[http://www.dokuwiki.org/devel:caching#purging_the_cache]]。 目前使用的插件: * Note, [[http://www.dokuwiki.org/plugin:note]] * Tag, [[http://www.dokuwiki.org/plugin:tag]] * Cloud, [[http://www.dokuwiki.org/plugin:cloud]] * Pagelist, [[http://www.dokuwiki.org/plugin:pagelist]] * Code2, [[http://www.dokuwiki.org/plugin:code2]] * Table Width, [[http://www.dokuwiki.org/plugin:tablewidth]]