105 lines
3.6 KiB
Markdown
105 lines
3.6 KiB
Markdown
|
||
## Ressources
|
||
|
||
- [Install](https://www.dokuwiki.org/install)
|
||
- [security](https://www.dokuwiki.org/security)
|
||
- [php](https://www.dokuwiki.org/install:php#php_configuration_for_dokuwiki)
|
||
- [non-official install](https://landchad.net/dokuwiki/)
|
||
- [installer.php](https://www.dokuwiki.org/installer)
|
||
- [download page](https://download.dokuwiki.org/)
|
||
- [used tarball](https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz)
|
||
|
||
## History
|
||
|
||
Install web server (ngnix), php and its desired modules:
|
||
```sh
|
||
apt install nginx php php-fpm php-xml php-mbstring php-zip php-intl php-gd php-json php-bz2
|
||
```
|
||
|
||
Download the [tarball](https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz) , unpack the distribution tarball and upload/copy the files to your webspace:
|
||
```sh
|
||
wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
|
||
tar xzvf dokuwiki-stable.tgz
|
||
mv dokuwiki-*a /var/www/dokuwiki
|
||
chown -R www-data:www-data /var/www/dokuwiki
|
||
```
|
||
|
||
Create the nginx config file at `/etc/nginx/sites-available/example.com` with the following input.
|
||
Nginx config example(change accordingly to your needs. mainly change "server_name"):
|
||
```conf
|
||
server {
|
||
listen 80;
|
||
listen [::]:80;
|
||
server_name example.com 10.0.0.10;
|
||
|
||
# Maximum file upload size is 4MB - change accordingly if needed
|
||
client_max_body_size 4M;
|
||
client_body_buffer_size 128k;
|
||
|
||
root /var/www/dokuwiki;
|
||
index doku.php;
|
||
|
||
#Remember to comment the below out when you're installing, and uncomment it when done.
|
||
location ~ /(conf/|bin/|inc/|vendor/|install.php) { deny all; }
|
||
|
||
|
||
# .ht - .htaccess, .htpasswd, .htdigest, .htanything
|
||
# .git, .hg, .svn - Git, Mercurial, Subversion.
|
||
# .vs - Visual Studio (Code)
|
||
# All directories except lib.
|
||
# All "other" files that you dont want to delete, but dont want public.
|
||
location ~ /(\.ht|\.git|\.hg|\.svn|\.vs|data|conf|bin|inc|vendor|README|VERSION|SECURITY.md|COPYING|composer.json|composer.lock) {
|
||
# Returns 403
|
||
deny all;
|
||
#return 404;
|
||
}
|
||
|
||
|
||
#Support for X-Accel-Redirect
|
||
location ~ ^/data/ { internal ; }
|
||
|
||
location ~ ^/lib.*\.(js|css|gif|png|ico|jpg|jpeg)$ {
|
||
expires 365d;
|
||
}
|
||
|
||
location / { try_files $uri $uri/ @dokuwiki; }
|
||
|
||
location @dokuwiki {
|
||
# rewrites "doku.php/" out of the URLs if you set the userwrite setting to .htaccess in dokuwiki config page
|
||
rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
|
||
rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
|
||
rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
|
||
rewrite ^/(.*) /doku.php?id=$1&$args last;
|
||
}
|
||
|
||
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:/var/run/php/php-fpm.sock;
|
||
# fastcgi_pass unix:/var/run/php5-fpm.sock; #old php version
|
||
}
|
||
}
|
||
```
|
||
|
||
Enable the Website:
|
||
```sh
|
||
ln -s /etc/nginx/sites-available/dokuwiki /etc/nginx/sites-enabled/
|
||
```
|
||
|
||
Restart nginx and php in order for the changes to take effect:
|
||
```sh
|
||
systemctl restart nginx && systemctl restart php8.2-fpm
|
||
```
|
||
|
||
To run the installer, open the page http://DokuWiki-IP/install.php in the web browser. Follow [installer.php manual](https://www.dokuwiki.org/installer).
|
||
|
||
|
||
Once that’s done, remember to uncomment the location line on the nginx configuration file.
|
||
Open `/etc/nginx/sites-available/dokuwiki` with a text editor and remove the “#” symbol at the beginning of the line.
|
||
|
||
Reload nginx once again so that the changes take effect.
|
||
```sh
|
||
systemctl restart nginx
|
||
``` |