dokuwiki 安装指南 (基于 Ubuntu 16.04 和 php 7.0)
1、安装 nginx (若已安装则跳过)
运行命令:
1
| sudo apt-get install nginx
|
编辑 /etc/nginx/nginx.conf 文件,把 server_tokens off 前的注释删除,防止暴露 nginx 和服务器的版本号
2、安装 php (若已安装则跳过)
运行命令:
1
| sudo apt-get install php php-xml
|
3、下载 dokuwiki 源码
1
| sudo chown -R www-data:www-data /var/www/dokuwiki
|
4、增加 nginx 配置
在 /etc/nginx/sites-available 目录下增加一个文件名叫 dokuwiki
1
| sudo vi /etc/nginx/sites-available/dokuwiki
|
内容如下:(也可参考官方说明
https://www.dokuwiki.org/install:nginx
)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
| server {
listen 80;
server_name _;
# Maximum file upload size is 4MB
client_max_body_size 4M;
client_body_buffer_size 128k;
root /var/www/dokuwiki;
index index.php;
# 安装结束后,启用下面这句配置,防止重新安装。
#location ~ /(data/|conf/|bin/|inc/|install.php) { deny all; }
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php7.0-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
|
启用该站点配置,在sites-enabled目录下创建一个软链接:
1
| sudo ln -s /etc/nginx/sites-available/dokuwiki /etc/nginx/sites-enabled/
|
5、启动 nginx
运行命令
1
| sudo service nginx start
|
6、安装
打开浏览器,输入 http://localhost/install.php , 按照页面提示步骤进行安装。
7、禁止再次安装
重新修改 /etc/nginx/sites-available/dokuwiki ,
把
1
2
| # 安装结束后,启用下面这句配置,防止重新安装。
#location ~ /(data/|conf/|bin/|inc/|install.php) { deny all; }
|
这句前的注释删除,然后重新加载 nginx
1
| sudo service nginx reload
|