Last active
July 10, 2021 14:32
-
-
Save lifeisfoo/1e735677ac0f95aa32c213e7c32a38d7 to your computer and use it in GitHub Desktop.
10 steps - a simple guide to setup dokuwiki on nginx and ubuntu 16.04 (even on AWS EC2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. update apt | |
apt-get update | |
# 2. install nginx and php (source https://forum.dokuwiki.org/post/52724;?unb855sess=af28c8160e97b05e634124aa83451119) | |
apt-get install nginx php php-fpm php7.0-xml | |
# 3. download dokuwiki | |
curl https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz -o dokuwiki.tgz | |
tar xvf dokuwiki.tgz | |
dokuwiki-2017-02-19e /var/www/dokuwiki | |
# 4. create an nginx conf, we'll use default for an easy setup | |
vim /etc/nginx/sites-available/default | |
# 5. add this to the file: | |
##### START #### | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
client_max_body_size 4M; | |
client_body_buffer_size 128k; | |
root /var/www/dokuwiki; | |
# Add index.php to the list if you are using PHP | |
index doku.php | |
server_name _; | |
# SECURITY: this should be uncomment AFTER the INSTALLATION | |
# location ~ /(data/|conf/|bin/|inc/|install.php) { deny all; } | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires 31536000s; | |
add_header Pragma "public"; | |
add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate"; | |
log_not_found off; | |
} | |
location / { try_files $uri $uri/ @dokuwiki; } | |
location @dokuwiki { | |
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:/run/php/php7.0-fpm.sock; | |
} | |
} | |
# 6. restart nginx | |
service nginx restart | |
# 7. visit /install.php and follow the instructions | |
# 8. uncomment the "SECURITY" line in your nginx conf | |
# 9. delete install.php | |
# 10. review files and directory permission if a warning is shown - https://www.dokuwiki.org/security#web_access_security | |
# 11. visit your wiki, now it should be installed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment