我已经通过 apt-get 安装了 dokuwiki。第一次调用时http://localhost/dokuwiki
返回“403 Forbidden”作为响应:
Achtung! HTTP/1.1 403 Forbidden
You don't have permission to access /dokuwiki on this server.
在日志文件(/var/log/apache2/error.log)中我发现以下内容:
client denied by server configuration: /usr/share/dokuwiki/
我不知道到底出了什么问题。所以我尝试了这个:
sudo chmod -R 755 /usr/share/dokuwiki
sudo chown -R www-data:root /usr/share/dokuwiki
但问题没有解决。有什么想法吗?
编辑:
https.conf 为空,这里输出
-rw-r--r-- 1 root root 0 Mai 2 21:11 /etc/apache2/httpd.conf
并且 /usr/share/dokuwiki/.htaccess 看起来不错(恕我直言):
## Enable this to restrict editing to logged in users only
## You should disable Indexes and MultiViews either here or in the
## global config. Symlinks maybe needed for URL rewriting.
#Options -Indexes -MultiViews +FollowSymLinks
## make sure nobody gets the htaccess, README, COPYING or VERSION files
<Files ~ "^([\._]ht|README$|VERSION$|COPYING$)">
Order allow,deny
Deny from all
Satisfy All
</Files>
## Uncomment these rules if you want to have nice URLs using
## $conf['userewrite'] = 1 - not needed for rewrite mode 2
#RewriteEngine on
#
## Not all installations will require the following line. If you do,
## change "/dokuwiki" to the path to your dokuwiki directory relative
## to your document root.
#RewriteBase /dokuwiki
#
## If you enable DokuWikis XML-RPC interface, you should consider to
## restrict access to it over HTTPS only! Uncomment the following two
## rules if your server setup allows HTTPS.
#RewriteCond %{HTTPS} !=on
#RewriteRule ^lib/exe/xmlrpc.php$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
#
#RewriteRule ^_media/(.*) lib/exe/fetch.php?media=$1 [QSA,L]
#RewriteRule ^_detail/(.*) lib/exe/detail.php?media=$1 [QSA,L]
#RewriteRule ^_export/([^/]+)/(.*) doku.php?do=export_$1&id=$2 [QSA,L]
#RewriteRule ^$ doku.php [L]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule (.*) doku.php?id=$1 [QSA,L]
#RewriteRule ^index.php$ doku.php
答案1
我找到了一个解决方案:
在 /etc/apache2/sites-available/default 中我输入了以下内容:
<Directory /usr/share/dokuwiki/>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
如果您从其他机器迁移,则需要将文件夹复制data
到 /var/lib/dokuwiki/
sudo cp -r ~/data /var/lib/dokuwiki/
之后我只更改了数据文件夹的权限:
sudo chmod -R 775 /var/lib/dokuwiki/data
sudo chown -R www-data:www-data /var/lib/dokuwiki/data
现在我的 dokuwiki 运行正常。