{"id":307,"date":"2018-05-19T19:49:30","date_gmt":"2018-05-19T11:49:30","guid":{"rendered":"https:\/\/www.techcoil.com\/blog\/?p=307"},"modified":"2018-10-22T23:25:54","modified_gmt":"2018-10-22T15:25:54","slug":"how-to-setup-your-own-wiki-site-on-a-raspberry-pi-3-with-dokuwiki-raspbian-stretch-lite-nginx-and-php","status":"publish","type":"post","link":"https:\/\/www.techcoil.com\/blog\/how-to-setup-your-own-wiki-site-on-a-raspberry-pi-3-with-dokuwiki-raspbian-stretch-lite-nginx-and-php\/","title":{"rendered":"How to setup your own Wiki site on a Raspberry Pi 3 with Dokuwiki, Raspbian Stretch Lite, Nginx and PHP"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/dokuwiki-and-raspbian-icon.gif\" alt=\"Dokuwiki and Raspbian icon\"\/><\/p>\n<p>As a result of the proliferation of <a href=\"https:\/\/www.techcoil.com\/glossary\/single-board-computer\/\" rel=\"noopener\" target=\"_blank\">single-board computers<\/a> like the <a href=\"https:\/\/www.amazon.com\/s\/ref=as_li_ss_tl?url=search-alias=aps&field-keywords=Raspberry+Pi+3&linkCode=ll2&tag=clivsperswebs-20&linkId=cb590150c8431a0557afdf858f3fb464\" rel=\"noopener\" target=\"_blank\">Raspberry Pi 3<\/a>, we get energy-efficient computers. In addition to being energy-efficient, Raspberry Pi 3 is small and priced affordably. Therefore, the Raspberry Pi 3 is an ideal <a href=\"https:\/\/www.techcoil.com\/shop\/for\/gifts-for-programmers\" rel=\"noopener\" target=\"_blank\">gift for programmers<\/a>. <\/p>\n<p>Given that you had received one as a programmer, you may be wondering <a href=\"https:\/\/www.techcoil.com\/raspberry-pi-3-project-ideas-for-programmers-software-engineers-software-developers-or-anyone-who-codes\/\" rel=\"noopener\" target=\"_blank\">what you can do with it<\/a>. In case you are yearning for your own Wiki site, you may consider setting up your <a href=\"https:\/\/www.dokuwiki.org\/\" rel=\"noopener\" target=\"_blank\">DokuWiki<\/a> site on your Raspberry Pi 3. <\/p>\n<p>With this in mind, this post walks through how you can setup your own Wiki site on a Raspberry Pi 3 with <a href=\"https:\/\/www.techcoil.com\/raspbian-stretch-lite-project-ideas\/\" rel=\"noopener\" target=\"_blank\">Raspbian Stretch Lite<\/a>, <a href=\"https:\/\/nginx.org\/en\/\" rel=\"noopener\" target=\"_blank\">Nginx<\/a> and <a href=\"http:\/\/www.php.net\/\" rel=\"noopener\" target=\"_blank\">PHP<\/a>.<\/p>\n<h2>Recommended hardware list for your own Raspberry Pi 3 Dokuwiki<\/h2>\n<p>In case you are wondering <a href=\"https:\/\/www.techcoil.com\/raspberry-pi-3-buying-guide\/\" rel=\"noopener\" target=\"_blank\">what to buy for your Raspberry Pi 3 project<\/a>, you can consider the following hardware list:   <\/p>\n<ul>\n<li><a href=\"https:\/\/www.amazon.com\/CanaKit-Raspberry-Micro-Supply-Listed\/dp\/B01C6FFNY4\/ref=as_li_ss_tl?s=pc&ie=UTF8&qid=1517212574&sr=1-4&keywords=raspberry+pi+3&linkCode=ll1&tag=clivsperswebs-20&linkId=76113a630916ac804456aa1f5dd76c85\" rel=\"noopener\" target=\"_blank\">CanaKit Raspberry Pi 3 with 2.5A Micro USB Power Supply<\/a> or <a href=\"https:\/\/www.amazon.com\/CanaKit-Raspberry-Power-Supply-Listed\/dp\/B07BC6WH7V\/\/ref=as_li_ss_tl?ie=UTF8&linkCode=ll1&tag=clivsperswebs-20&linkId=facc24accf03fbe5cd45b1893a1e9ab1\" rel=\"noopener\" target=\"_blank\">CanaKit Raspberry Pi 3 B+ (B Plus) with 2.5A Power Supply (UL Listed)<\/a><\/li>\n<li><a href=\"https:\/\/www.amazon.com\/dp\/B01F1PSFY6\/ref=as_li_ss_tl?ie=UTF8&linkCode=ll1&tag=clivsperswebs-20&linkId=d68c56d79a1d84f89f596fa715743a9e\" rel=\"noopener\" target=\"_blank\">Raspberry Pi 2\/3 official case Black\/Grey<\/a> or <a href=\"https:\/\/www.amazon.com\/dp\/B01CCPKCSK\/ref=as_li_ss_tl?ie=UTF8&linkCode=ll1&tag=clivsperswebs-20&linkId=1e69ae5649504fb86c6597e0774eb3d8\" rel=\"noopener\" target=\"_blank\">Raspberry Pi 2\/3 official case Red\/White<\/a><\/li>\n<li><a href=\"https:\/\/www.amazon.com\/Sandisk-Ultra-Micro-UHS-I-Adapter\/dp\/B073JWXGNT\/ref=as_li_ss_tl?ie=UTF8&linkCode=ll1&tag=clivsperswebs-20&linkId=20db403fc5e8bbc15e46ec21868a1488\" rel=\"noopener\" target=\"_blank\"> Sandisk Ultra 32GB Micro SDHC UHS-I Card with Adapter<\/a><\/li>\n<li><a href=\"https:\/\/www.amazon.com\/gp\/product\/B00N2VISLW\/ref=as_li_tl?ie=UTF8&tag=clivsperswebs-20&camp=1789&creative=9325&linkCode=as2&creativeASIN=B00N2VISLW&linkId=132403a064ff21634835c1deee4bc983\" target=\"_blank\">AmazonBasics RJ45 Cat-6 Ethernet Patch Cable - 3 Feet (0.9 Meters)<\/a><\/li>\n<\/ul>\n<h2>Setting up Raspbian Stretch Lite with SSH server enabled on your microSD card<\/h2>\n<p>Once you had gathered all the necessary hardware, proceed to <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-setup-raspbian-stretch-lite-with-ssh-server-enabled-on-your-microsd-card\/\" rel=\"noopener\" target=\"_blank\">setup Raspbian Stretch Lite with SSH server enabled on your microSD card<\/a>. When you had done so, you will be able to SSH into your Raspbian Stretch Lite to perform further configurations. <\/p>\n<h2>Assembling the hardware for your Raspberry Pi 3 Wiki site<\/h2>\n<p>Next, remove your microSD card from your SD card reader and insert it to the microSD card slot on the Raspberry Pi 3 board. Thereafter, proceed to <a href=\"\/blog\/how-to-assemble-the-raspberry-pi-3-board-with-the-raspberry-pi-official-case\/\" target=\"_blank\">assemble the Raspberry Pi 3 board to the Official Raspberry Pi case<\/a>.<\/p>\n<h2>Starting the Raspbian Stretch Lite operating system<\/h2>\n<p>Following the assembly of your Raspberry Pi 3 board and Official Raspberry Pi case, connect one end of the RJ45 cable to the RJ45 port on your Raspberry Pi 3 board and the other end of the cable to one of the switch port of your <a href=\"https:\/\/www.amazon.com\/s\/ref=as_li_ss_tl?url=search-alias=aps&field-keywords=home+router&linkCode=ll2&tag=clivsperswebs-20&linkId=6c98d01cf201ca0ba30aef3b3c806168\" target=\"_blank\">home router<\/a>. After that, connect your micro USB cable and supply power to your Raspberry Pi 3 board.<\/p>\n<h2>Changing default password, Locale and Timezone of your Raspbian Stretch Lite<\/h2>\n<p>There are a few configurations that we should perform on the first run of our Raspbian Stretch Lite. Therefore, proceed on to <a href=\"https:\/\/www.techcoil.com\/blog\/set-of-configurations-to-perform-on-the-first-run-of-your-raspbian-stretch-lite\/\" rel=\"noopener\" target=\"_blank\">change the default password, Locale and Timezone of Raspbian Stretch Lite<\/a>.  <\/p>\n<h2>Installing Nginx on Raspbian Stretch Lite<\/h2>\n<p>Once you had preformed the configurations on the first run of your Raspbian Stretch Lite, proceed on to install Nginx. To install Nginx on Raspbian Stretch Lite, run the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get update\r\nsudo apt-get install nginx -y\r\n<\/pre>\n<p>After that, run the following command to verify that the installation was successful:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsystemctl status nginx.service\r\n<\/pre>\n<p>At this point, as an indication that Nginx was installed successfull, you should see output similar to the following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\u25cf nginx.service - A high performance web server and a reverse proxy server\r\n   Loaded: loaded (\/lib\/systemd\/system\/nginx.service; enabled; vendor preset: enabled)\r\n   Active: active (running) since Wed 2018-05-16 19:25:05 UTC; 7min ago\r\n     Docs: man:nginx(8)\r\n  Process: 15356 ExecStart=\/usr\/sbin\/nginx -g daemon on; master_process on; (code=exited, status=0\/SUCCESS)\r\n  Process: 15353 ExecStartPre=\/usr\/sbin\/nginx -t -q -g daemon on; master_process on; (code=exited, status=0\/SUCCESS\r\n Main PID: 15357 (nginx)\r\n   CGroup: \/system.slice\/nginx.service\r\n           \u251c\u250015357 nginx: master process \/usr\/sbin\/nginx -g daemon on; master_process on;\r\n           \u251c\u250015358 nginx: worker process\r\n           \u251c\u250015359 nginx: worker process\r\n           \u251c\u250015360 nginx: worker process\r\n           \u2514\u250015361 nginx: worker process\r\n \r\nMay 16 19:25:05 raspberrypi systemd&#x5B;1]: Starting A high performance web server and a reverse proxy server...\r\nMay 16 19:25:05 raspberrypi systemd&#x5B;1]: Started A high performance web server and a reverse proxy server.\r\n<\/pre>\n<h2>Installing PHP 7 on your Raspbian Stretch Lite<\/h2>\n<p>Since Dokuwiki is written in PHP, proceed to install PHP7, PHP7 Fast CGI Process Manager and <code>php7.0-mbstring<\/code>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo apt-get install php7.0 php7.0-fpm php7.0-mbstring -y\r\n<\/pre>\n<p>After that, verify your PHP installation with the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsystemctl status php7.0-fpm.service\r\n<\/pre>\n<p>At this instant, as an indication that PHP 7 was installed successfully, you should see output similar to the following:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\u25cf php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager\r\n   Loaded: loaded (\/lib\/systemd\/system\/php7.0-fpm.service; enabled; vendor preset: enabled)\r\n   Active: active (running) since Wed 2018-05-16 19:25:05 +8; 7min ago\r\n     Docs: man:php-fpm7.0(8)\r\n Main PID: 7995 (php-fpm7.0)\r\n   Status: &quot;Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req\/sec&quot;\r\n   CGroup: \/system.slice\/php7.0-fpm.service\r\n           \u251c\u25007995 php-fpm: master process (\/etc\/php\/7.0\/fpm\/php-fpm.conf)\r\n           \u251c\u25007996 php-fpm: pool www\r\n           \u2514\u25007997 php-fpm: pool www\r\n \r\nMay 16 19:25:05 raspberrypi systemd&#x5B;1]: Starting The PHP 7.0 FastCGI Process Manager...\r\nMay 16 19:25:06 raspberrypi systemd&#x5B;1]: Started The PHP 7.0 FastCGI Process Manager.\r\n<\/pre>\n<h2>Downloading a copy of Dokuwiki<\/h2>\n<p>Once you had verified that PHP 7 was installed successfully, you can proceed to download a copy of Dokuwiki. To do so, run the following commands:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncd \/var\/www\r\nsudo wget https:\/\/download.dokuwiki.org\/src\/dokuwiki\/dokuwiki-stable.tgz\r\nsudo tar xfz dokuwiki-stable.tgz\r\nsudo rm dokuwiki-stable.tgz\r\n<\/pre>\n<p>After that, you will find a directory <code>\/var\/www\/dokuwiki-xxx<\/code> where xxx can vary depending on the version of the stable release. For the purpose of this guide, let us assume that we had gotten the directory <code>\/var\/www\/dokuwiki-2018-04-22a<\/code>. This is the directory that contains the source code for realising your Wiki site.<\/p>\n<h2>Changing the owner of \/var\/www\/dokuwiki-2018-04-22a directory to www-data user<\/h2>\n<p>Since Dokuwiki keeps data within the source directory by default, you should change the ownership of <code>\/var\/www\/dokuwiki-2018-04-22a<\/code> directory to <code>www-data<\/code> user. To do so, run the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo chown -R www-data:www-data \/var\/www\/dokuwiki-2018-04-22a\r\n<\/pre>\n<h2>Configuring Nginx to proxy HTTP requests bound for a custom domain to PHP 7 Fast CGI Manager<\/h2>\n<p>At this point in time, you are ready to configure Nginx to proxy HTTP requests bound for a custom domain. For the purpose of this guide, let's arbitrarily define the custom domain as <strong>mydokuwikiathome<\/strong>. Whenever Nginx sees HTTP requests made to <strong>http:\/\/mydokuwikiathome<\/strong>, it should proxy those requests to PHP 7 Fast CGI Manager so as to bring up Dokuwiki.<\/p>\n<p>With this in mind, first create a Nginx configuration file at <code>\/etc\/nginx\/sites-enabled\/mydokuwikiathome.conf<\/code> with the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo nano \/etc\/nginx\/sites-enabled\/mydokuwikiathome.conf\r\n<\/pre>\n<p>Once <code>nano<\/code> editor loads up, copy the following content to the editor:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nserver {\r\n    listen               80;\r\n    server_name          mydokuwikiathome;\r\n \r\n    root \/var\/www\/dokuwiki-2018-04-22a;\r\n\r\n    location \/ {\r\n        index doku.php; \r\n        try_files $uri $uri\/ @dokuwiki; \r\n    }\r\n \r\n    location @dokuwiki {\r\n        rewrite ^\/_media\/(.*) \/lib\/exe\/fetch.php?media=$1 last;\r\n        rewrite ^\/_detail\/(.*) \/lib\/exe\/detail.php?media=$1 last;\r\n        rewrite ^\/_export\/(&#x5B;^\/]+)\/(.*) \/doku.php?do=export_$1&amp;id=$2 last;\r\n        rewrite ^\/(.*) \/doku.php?id=$1&amp;$args last;\r\n    }\r\n \r\n    location ~ \\.php$ {\r\n        include fastcgi_params;\r\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n        fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\r\n    }   \r\n\r\n    location ~ \/(data|conf|bin|inc)\/ {\r\n        deny all;\r\n    }\r\n\r\n}\r\n<\/pre>\n<p>After that, type <strong>Ctrl-X<\/strong> followed by <strong>Y<\/strong> to save the configuration file.<\/p>\n<p>Once you had saved the configuration file, run the following command to restart Nginx:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl restart nginx.service\r\n<\/pre>\n<h2>Setting your hosts file to point mydokuwikiathome to the IP address of your Raspberry Pi 3<\/h2>\n<p>Once you had restarted Nginx, go to your hosts file in your computer and add in a row like the following:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n192.168.1.109 mydokuwikiathome\r\n<\/pre>\n<p>In this case, your browser will send HTTP requests to <code>192.168.1.109<\/code> whenever it sees the domain name <code>mydokuwikiathome<\/code>. In case your Raspberry Pi 3 gets a different IP address, make sure to substitute that IP address with <code>192.168.1.109<\/code>.<\/p>\n<h2>Triggering the install script for DokuWiki<\/h2>\n<p>Following the changes to your hosts file, open up your favourite browser on your computer and enter <code>http:\/\/mydokuwikiathome\/install.php<\/code> in the location bar. After that, you should see the following screen:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/DokuWiki-version-2018-04-22a-installer-screen.gif\" alt=\"DokuWiki version 2018-04-22a installer screen\"\/><\/p>\n<p>Once you had filled in the necessary input fields, click the <strong>Save<\/strong> button. After that, you will be presented with the following screen:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/DokuWiki-version-2018-04-22a-installer-screen-after-saving-initial-setup-info.gif\" alt=\"DokuWiki version 2018-04-22a installer screen after saving initial setup info\" \/><\/p>\n<p>This is an indication that you had gotten a DokuWiki site running on your Raspberry Pi 3.<\/p>\n<p>Since DokuWiki had suggested you to delete <code>install.php<\/code>, go back to the SSH terminal session and run the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo rm \/var\/www\/dokuwiki-2018-04-22a\/install.php\r\n<\/pre>\n<h2>Configuring your DokuWiki to be accessed from outside your home network via HTTPS with Let's Encrypt certificate<\/h2>\n<p>At this point in time, you had setup a DokuWiki site on your Raspberry Pi 3 that can only be accessed from within your home network.<\/p>\n<p>In case you want to access your DokuWiki site from outside your home network, there are more configurations to be done.<\/p>\n<h3>Pre-requisites<\/h3>\n<p>As mentioned in an earlier post on <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-host-multiple-websites-from-home\/\" rel=\"noopener\" target=\"_blank\">how to host multiple websites from home<\/a>, you will need the following pieces for enabling your DokuWiki site to be accessed from outside your home network via HTTPS with Let's Encrypt browser-trusted certificate:<\/p>\n<ul>\n<li>A domain or subdomain name that is mapped to the public IP address that your <a href=\"https:\/\/www.amazon.com\/s\/ref=as_li_ss_tl?url=search-alias=aps&field-keywords=home+network+router&rh=i:aps,k:home+network+router&linkCode=ll2&tag=clivsperswebs-20&linkId=6d206156ec9fc599fc44332cd5cfe69d\" rel=\"noopener\" target=\"_blank\">home router<\/a> had gotten from the Internet Service Provider. If your public IP address changes frequently, you may want to <a href=\"https:\/\/namecheap.pxf.io\/c\/1303251\/386170\/5618?u=https%3A%2F%2Fwww.namecheap.com%2Fdomains%2Fdomain-name-search.aspx\" rel=\"noopener\" target=\"_blank\">buy a Namecheap domain<\/a> and <a href=\"https:\/\/www.techcoil.com\/blog\/how-to-get-your-raspberry-pi-3-to-use-namecheap-dynamic-dns-to-update-your-domain-when-your-homes-public-ip-address-changes\/\" rel=\"noopener\" target=\"_blank\">get your Raspberry Pi 3 to use Namecheap dynamic DNS to update your domain when your home\u2019s public IP address changes<\/a>.<\/li>\n<li>Forwarding of network traffic made to port 80 and 443 of your home router public IP address to the IP address of the Raspberry Pi 3 that contains your DokuWiki site. If you happen to use <a href=\"https:\/\/www.amazon.com\/Linksys-AC1900-Wireless-Router-EA7500\/dp\/B019WAQMVY\/ref=as_li_ss_tl?&imprToken=qcAImKE7aE8G.bRcryc8vw&slotNum=0&ie=UTF8&qid=1503367796&sr=8-2&keywords=linksys+ea7500+max-stream%E2%84%A2+ac1900&linkCode=ll1&tag=clivsperswebs-20&linkId=fc9a5b11e3d3873d432686f3e699a1e6\" rel=\"noopener\" target=\"_blank\">Linksys EA7500 Max-Stream AC1900 router<\/a>, you can <a href=\"https:\/\/www.techcoil.com\/blog\/host-web-server-behind-linksys-ea7500-max-stream-ac1900-router\/\" rel=\"noopener\" target=\"_blank\">checkout this post on how to do so<\/a>.<\/li>\n<\/ul>\n<h3>Installing CertBot<\/h3>\n<p>Once you had met the pre-requisites, proceed to <a href=\"https:\/\/www.techcoil.com\/blog\/installing-certbot-on-raspbian-stretch-lite-for-obtaining-lets-encrypts-browser-trusted-certificates\/\" rel=\"noopener\" target=\"_blank\">install Certbot on Raspbian Stretch Lite<\/a>.<\/p>\n<h3>Configuring Nginx to facilitate Certbot in acquiring the SSL certificate for your domain or subdomain<\/h3>\n<p>For the purpose of this guide, let's assume that you had designated <strong>wiki.yourdomain.com<\/strong> as the domain to reach your DokuWiki site on your Raspberry Pi 3.<\/p>\n<p>With this in mind, let's first move <code>\/etc\/nginx\/sites-enabled\/mydokuwikiathome.conf<\/code><br \/>\n to <code>\/etc\/nginx\/sites-enabled\/wiki.yourdomain.com.conf<\/code>:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo mv \/etc\/nginx\/sites-enabled\/mydokuwikiathome.conf \/etc\/nginx\/sites-enabled\/wiki.yourdomain.com.conf\r\n<\/pre>\n<p>Once you had done so, open up <code>\/etc\/nginx\/sites-enabled\/wiki.yourdomain.com.conf<\/code> with nano:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo nano \/etc\/nginx\/sites-enabled\/wiki.yourdomain.com.conf\r\n<\/pre>\n<p>After that, edit the contents of <code>\/etc\/nginx\/sites-enabled\/wiki.yourdomain.com.conf<\/code> to look like the following:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nserver {\r\n    listen               80;\r\n    server_name          wiki.yourdomain.com;\r\n \r\n    root \/var\/www\/dokuwiki-2018-04-22a;\r\n\r\n    # For ACME challenge\r\n    location ~ \/.well-known {\r\n        allow all;\r\n    }\r\n\r\n    location \/ {\r\n        index doku.php; \r\n        try_files $uri $uri\/ @dokuwiki; \r\n    }\r\n \r\n    location @dokuwiki {\r\n        rewrite ^\/_media\/(.*) \/lib\/exe\/fetch.php?media=$1 last;\r\n        rewrite ^\/_detail\/(.*) \/lib\/exe\/detail.php?media=$1 last;\r\n        rewrite ^\/_export\/(&#x5B;^\/]+)\/(.*) \/doku.php?do=export_$1&amp;id=$2 last;\r\n        rewrite ^\/(.*) \/doku.php?id=$1&amp;$args last;\r\n    }\r\n \r\n    location ~ \\.php$ {\r\n        include fastcgi_params;\r\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n        fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\r\n    }   \r\n\r\n    location ~ \/(data|conf|bin|inc)\/ {\r\n        deny all;\r\n    }\r\n\r\n}\r\n<\/pre>\n<p>Once you had edited the contents, type <strong>Ctrl-X<\/strong> followed by <strong>Y<\/strong> to save the configuration file.<\/p>\n<p>After that, run the following command to restart Nginx:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl restart nginx.service\r\n<\/pre>\n<p>As a result of these configuration changes, Nginx server will proxy HTTP requests bound for http:\/\/wiki.yourdomain.com to PHP 7 FPM to load up your DokuWiki site.<\/p>\n<p>In addition, these configuration changes allow Let's Encrypt servers to access a secret file that Certbot will create inside <code>\/var\/www\/dokuwiki-2018-04-22a\/.well-known<\/code> directory later. That is one of the steps that Certbot does in the process of requesting for Let's Encrypt browser-trusted certificate.<\/p>\n<h3>Running Certbot to get the SSL certificate artefacts for your domain \/ subdomain<\/h3>\n<p>Once you had configured Nginx to facilitate Certbot in acquiring the SSL certificate for your domain or subdomain, you can run Certbot to get the SSL certificate artefacts for your domain \/ subdomain. To do so, run the following command:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo certbot certonly -a webroot --webroot-path=\/var\/www\/dokuwiki-2018-04-22a -d wiki.yourdomain.com\r\n<\/pre>\n<h3>Generating a Diffie-Hellman group<\/h3>\n<p>Once Certbot had fetched the SSL certificate artefacts for your domain \/ subdomain, proceed on to generate a Diffie-Hellman group for Nginx to use for exchanging cryptographic keys with its clients:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo openssl dhparam -out \/etc\/ssl\/certs\/dhparam.pem 2048\r\n<\/pre>\n<h3>Configuring Nginx to serve HTTPS traffic<\/h3>\n<p>With the Diffie-Hellman group generated, you can proceed on to configure Nginx to serve HTTPS traffic for requests made to your DokuWiki site.<\/p>\n<p>To do so, open up <code>\/etc\/nginx\/sites-enabled\/wiki.yourdomain.com.conf<\/code> with nano:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo nano \/etc\/nginx\/sites-enabled\/wiki.yourdomain.com.conf\r\n<\/pre>\n<p>Once nano editor appears, paste in the following content:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nserver {\r\n    listen 80;\r\n    server_name  wiki.yourdomain.com;\r\n    return 301 https:\/\/$host$request_uri;\r\n}\r\n   \r\n# For ssl\r\nserver {\r\n    ssl on;\r\n    ssl_certificate \/etc\/letsencrypt\/live\/wiki.yourdomain.com\/fullchain.pem;\r\n    ssl_certificate_key \/etc\/letsencrypt\/live\/wiki.yourdomain.com\/privkey.pem;\r\n    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\r\n    ssl_prefer_server_ciphers on;\r\n    ssl_dhparam \/etc\/ssl\/certs\/dhparam.pem;\r\n    ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';\r\n    ssl_session_timeout 1d;\r\n    ssl_session_cache shared:SSL:50m;\r\n    ssl_stapling on;\r\n    ssl_stapling_verify on;\r\n    add_header Strict-Transport-Security max-age=15768000;\r\n       \r\n    default_type  application\/octet-stream;\r\n       \r\n    listen 443;\r\n    server_name  wiki.yourdomain.com;\r\n\r\n    root \/var\/www\/dokuwiki-2018-04-22a;\r\n\r\n    # For ACME challenge\r\n    location ~ \/.well-known {\r\n        allow all;\r\n    }\r\n\r\n    location \/ {\r\n        index doku.php; \r\n        try_files $uri $uri\/ @dokuwiki; \r\n    }\r\n \r\n    location @dokuwiki {\r\n        rewrite ^\/_media\/(.*) \/lib\/exe\/fetch.php?media=$1 last;\r\n        rewrite ^\/_detail\/(.*) \/lib\/exe\/detail.php?media=$1 last;\r\n        rewrite ^\/_export\/(&#x5B;^\/]+)\/(.*) \/doku.php?do=export_$1&amp;id=$2 last;\r\n        rewrite ^\/(.*) \/doku.php?id=$1&amp;$args last;\r\n    }\r\n \r\n    location ~ \\.php$ {\r\n        include fastcgi_params;\r\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n        fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\r\n    }   \r\n\r\n    location ~ \/(data|conf|bin|inc)\/ {\r\n        deny all;\r\n    }\r\n\r\n}\r\n<\/pre>\n<p>After that, type <strong>Ctrl-X<\/strong> followed by <strong>Y<\/strong> to save the configuration file.<\/p>\n<p>Once you had saved the configuration file, run the following command to restart Nginx:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo systemctl restart nginx.service\r\n<\/pre>\n<p>After that, you will be able to access your DokuWiki site from outside your home network via HTTPS with Let's Encrypt certificate.<\/p>\n<h2>Buying the Raspberry Pi 3 hardware to host your own DokuWiki site<\/h2>\n<p>If you do not have the Raspberry Pi 3 hardware mentioned in this post yet, you may want to purchase them from Amazon. Simply click on the button below to add the Raspberry Pi 3 hardware to your cart. You may remove anything that you already have or replace some of the hardware with other hardware.<\/p>\n<p><center><\/p>\n<form action=\"https:\/\/www.amazon.com\/gp\/aws\/cart\/add.html\" method=\"GET\" target=\"_blank\"><input name=\"AssociateTag\" type=\"hidden\" value=\"clivsperswebs-20\"><input name=\"SubscriptionId\" type=\"hidden\" value=\"[AKIAIMND5UBCQU2HRSUA]\"><input name=\"ASIN.1\" type=\"hidden\" value=\"B07BC6WH7V\"><input name=\"Quantity.1\" type=\"hidden\" value=\"1\"><input name=\"ASIN.2\" type=\"hidden\" value=\"B01F1PSFY6\"><input name=\"Quantity.2\" type=\"hidden\" value=\"1\"><input name=\"ASIN.3\" type=\"hidden\" value=\"B073JWXGNT\"><input name=\"Quantity.3\" type=\"hidden\" value=\"1\"><input name=\"ASIN.4\" type=\"hidden\" value=\"B00N2VISLW\"><input name=\"Quantity.4\" type=\"hidden\" value=\"1\"><br \/>\n<input alt=\"Buy from Amazon.com\" name=\"add\" type=\"image\" src=\"https:\/\/images-na.ssl-images-amazon.com\/images\/G\/01\/associates\/remote-buy-box\/buy4.gif\" value=\"Buy from Amazon.com\"><\/form>\n<p><\/center><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/How-to-setup-your-own-Wiki-Site-on-your-Raspberry-Pi-3-with-Raspbian-Stretch-Lite-Dokuwiki-Nginx-and-PHP.jpg\" alt=\"How to setup your own Wiki Site on your Raspberry Pi 3 with Raspbian Stretch Lite, Dokuwiki Nginx and PHP\" \/><\/p>\n\n      <ul id=\"social-sharing-buttons-list\">\n        <li class=\"facebook\">\n          <a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwp.me%2Fp245TQ-4X\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n            <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Facebook.png\" alt=\"Facebook icon\"> Share\n          <\/a>\n        <\/li>\n        <li class=\"twitter\">\n          <a href=\"https:\/\/twitter.com\/intent\/tweet?text=&url=https%3A%2F%2Fwp.me%2Fp245TQ-4X&via=Techcoil_com\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Twitter.png\" alt=\"Twitter icon\"> Tweet\n          <\/a>\n        <\/li>\n        <li class=\"linkedin\">\n          <a href=\"https:\/\/www.linkedin.com\/shareArticle?mini=1&title=&url=https%3A%2F%2Fwp.me%2Fp245TQ-4X&source=https:\/\/www.techcoil.com\" target=\"_blank\" role=\"button\" rel=\"nofollow\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/linkedin.png\" alt=\"Linkedin icon\"> Share\n          <\/a>\n        <\/li>\n        <li class=\"pinterest\">\n          <a href=\"https:\/\/pinterest.com\/pin\/create\/button\/?url=https%3A%2F%2Fwww.techcoil.com%2Fblog%2Fwp-json%2Fwp%2Fv2%2Fposts%2F307&description=\" class=\"pin-it-button\" target=\"_blank\" role=\"button\" rel=\"nofollow\" count-layout=\"horizontal\">\n          <img decoding=\"async\" src=\"\/ph\/img\/3rd-party\/social-icons\/Pinterest.png\" alt=\"Pinterest icon\"> Save\n          <\/a>\n        <\/li>\n      <\/ul>\n    ","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/dokuwiki-and-raspbian-icon.gif\" alt=\"Dokuwiki and Raspbian icon\"\/><\/p>\n<p>As a result of the proliferation of <a href=\"https:\/\/www.techcoil.com\/glossary\/single-board-computer\/\" rel=\"noopener\" target=\"_blank\">single-board computers<\/a> like the <a href=\"https:\/\/www.amazon.com\/s\/ref=as_li_ss_tl?url=search-alias=aps&#038;field-keywords=Raspberry+Pi+3&#038;linkCode=ll2&#038;tag=clivsperswebs-20&#038;linkId=cb590150c8431a0557afdf858f3fb464\" rel=\"noopener\" target=\"_blank\">Raspberry Pi 3<\/a>, we get energy-efficient computers. In addition to being energy-efficient, Raspberry Pi 3 is small and priced affordably. Therefore, the Raspberry Pi 3 is an ideal <a href=\"https:\/\/www.techcoil.com\/shop\/for\/gifts-for-programmers\" rel=\"noopener\" target=\"_blank\">gift for programmers<\/a>. <\/p>\n<p>Given that you had received one as a programmer, you may be wondering <a href=\"https:\/\/www.techcoil.com\/raspberry-pi-3-project-ideas-for-programmers-software-engineers-software-developers-or-anyone-who-codes\/\" rel=\"noopener\" target=\"_blank\">what you can do with it<\/a>. In case you are yearning for your own Wiki site, you may consider setting up your <a href=\"https:\/\/www.dokuwiki.org\/\" rel=\"noopener\" target=\"_blank\">DokuWiki<\/a> site on your Raspberry Pi 3. <\/p>\n<p>With this in mind, this post walks through how you can setup your own Wiki site on a Raspberry Pi 3 with <a href=\"https:\/\/www.techcoil.com\/raspbian-stretch-lite-project-ideas\/\" rel=\"noopener\" target=\"_blank\">Raspbian Stretch Lite<\/a>, <a href=\"https:\/\/nginx.org\/en\/\" rel=\"noopener\" target=\"_blank\">nginx<\/a> and <a href=\"http:\/\/www.php.net\/\" rel=\"noopener\" target=\"_blank\">PHP<\/a>.<\/p>\n","protected":false},"author":1,"featured_media":1006,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"footnotes":""},"categories":[4],"tags":[529,266,225,13,444,240,308,412,445,195],"jetpack_featured_media_url":"https:\/\/www.techcoil.com\/blog\/wp-content\/uploads\/dokuwiki-and-raspbian-icon.gif","jetpack_shortlink":"https:\/\/wp.me\/p245TQ-4X","jetpack-related-posts":[],"jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/307"}],"collection":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/comments?post=307"}],"version-history":[{"count":0,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/posts\/307\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media\/1006"}],"wp:attachment":[{"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/media?parent=307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/categories?post=307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.techcoil.com\/blog\/wp-json\/wp\/v2\/tags?post=307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}