freedombone-app-dokuwiki 34KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # Dokuwiki application
  12. #
  13. # License
  14. # =======
  15. #
  16. # Copyright (C) 2014-2016 Bob Mottram <bob@robotics.uk.to>
  17. #
  18. # This program is free software: you can redistribute it and/or modify
  19. # it under the terms of the GNU Affero General Public License as published by
  20. # the Free Software Foundation, either version 3 of the License, or
  21. # (at your option) any later version.
  22. #
  23. # This program is distributed in the hope that it will be useful,
  24. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. # GNU Affero General Public License for more details.
  27. #
  28. # You should have received a copy of the GNU Affero General Public License
  29. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  30. VARIANTS='full full-vim writer'
  31. IN_DEFAULT_INSTALL=1
  32. SHOW_ON_ABOUT=1
  33. DOKUWIKI_DOMAIN_NAME=
  34. DOKUWIKI_ADMIN_PASSWORD=
  35. DOKUWIKI_TITLE="${PROJECT_NAME} Dokuwiki"
  36. DOKUWIKI_CODE=
  37. DOKUWIKI_ONION_PORT=8089
  38. dokuwiki_variables=(ONION_ONLY
  39. MY_USERNAME
  40. DOKUWIKI_TITLE
  41. DOKUWIKI_DOMAIN_NAME
  42. DOKUWIKI_CODE
  43. DDNS_PROVIDER)
  44. function install_interactive_dokuwiki {
  45. if [[ $ONION_ONLY != "no" ]]; then
  46. DOKUWIKI_TITLE=$'My Dokuwiki'
  47. DOKUWIKI_DOMAIN_NAME='dokuwiki.local'
  48. write_config_param "DOKUWIKI_TITLE" "$DOKUWIKI_TITLE"
  49. write_config_param "DOKUWIKI_DOMAIN_NAME" "$DOKUWIKI_DOMAIN_NAME"
  50. else
  51. function_check interactive_site_details_with_title
  52. interactive_site_details_with_title "dokuwiki" "DOKUWIKI_TITLE" "DOKUWIKI_DOMAIN_NAME" "DOKUWIKI_CODE"
  53. fi
  54. APP_INSTALLED=1
  55. }
  56. function change_password_dokuwiki {
  57. echo -n ''
  58. }
  59. function reconfigure_dokuwiki {
  60. echo -n ''
  61. }
  62. function upgrade_dokuwiki {
  63. echo -n ''
  64. }
  65. function backup_local_dokuwiki {
  66. source_directory=/var/lib/dokuwiki
  67. if [ -d $source_directory ]; then
  68. dest_directory=dokuwiki
  69. echo $"Backing up $source_directory to $dest_directory"
  70. function_check backup_directory_to_usb
  71. backup_directory_to_usb $source_directory $dest_directory
  72. backup_directory_to_usb /etc/dokuwiki dokuwiki2
  73. echo $"Backup to $dest_directory complete"
  74. fi
  75. }
  76. function restore_local_dokuwiki {
  77. if [ -d /var/lib/dokuwiki ]; then
  78. echo $"Restoring Dokuwiki installation"
  79. function_check get_completion_param
  80. DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
  81. temp_restore_dir=/root/tempdokuwiki
  82. function_check restore_directory_from_usb
  83. restore_directory_from_usb $temp_restore_dir wiki
  84. restore_directory_from_usb $temp_restore_dir dokuwiki
  85. cp -r $temp_restore_dir/var/lib/dokuwiki/* /var/lib/dokuwiki/
  86. if [ ! "$?" = "0" ]; then
  87. function_check restore_directory_from_usb
  88. set_user_permissions
  89. function_check backup_unmount_drive
  90. backup_unmount_drive
  91. exit 868
  92. fi
  93. restore_directory_from_usb ${temp_restore_dir}2 dokuwiki2
  94. cp -r ${temp_restore_dir}2/etc/dokuwiki/* /etc/dokuwiki/
  95. if [ ! "$?" = "0" ]; then
  96. function_check set_user_permissions
  97. set_user_permissions
  98. function_check backup_unmount_drive
  99. backup_unmount_drive
  100. exit 869
  101. fi
  102. rm -rf $temp_restore_dir
  103. rm -rf ${temp_restore_dir}2
  104. chown -R www-data:www-data /var/lib/dokuwiki/*
  105. # Ensure that the bundled SSL cert is being used
  106. if [ -f /etc/ssl/certs/${DOKUWIKI_DOMAIN_NAME}.bundle.crt ]; then
  107. sed -i "s|${DOKUWIKI_DOMAIN_NAME}.crt|${DOKUWIKI_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${DOKUWIKI_DOMAIN_NAME}
  108. fi
  109. if [ -d /etc/letsencrypt/live/${DOKUWIKI_DOMAIN_NAME} ]; then
  110. ln -s /etc/letsencrypt/live/${DOKUWIKI_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${DOKUWIKI_DOMAIN_NAME}.key
  111. ln -s /etc/letsencrypt/live/${DOKUWIKI_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${DOKUWIKI_DOMAIN_NAME}.pem
  112. fi
  113. echo $"Restore of Dokuwiki complete"
  114. fi
  115. }
  116. function backup_remote_dokuwiki {
  117. if [ -d /etc/dokuwiki ]; then
  118. echo $"Backing up dokuwiki"
  119. backup_directory_to_friend /var/lib/dokuwiki dokuwiki
  120. backup_directory_to_friend /etc/dokuwiki dokuwiki2
  121. fi
  122. }
  123. function restore_remote_dokuwiki {
  124. if [ -d $SERVER_DIRECTORY/backup/dokuwiki ]; then
  125. function_check get_completion_param
  126. DOKUWIKI_DOMAIN_NAME=$(get_completion_param "dokuwiki domain")
  127. echo $"Restoring Dokuwiki installation $DOKUWIKI_DOMAIN_NAME"
  128. function_check restore_directory_from_friend
  129. restore_directory_from_friend /root/tempdokuwiki dokuwiki
  130. cp -r /root/tempdokuwiki/var/lib/dokuwiki/* /var/lib/dokuwiki/
  131. if [ ! "$?" = "0" ]; then
  132. exit 868
  133. fi
  134. restore_directory_from_friend /root/tempdokuwiki2 dokuwiki2
  135. cp -r /root/tempdokuwiki2/etc/dokuwiki/* /etc/dokuwiki/
  136. if [ ! "$?" = "0" ]; then
  137. exit 869
  138. fi
  139. rm -rf /root/tempdokuwiki
  140. rm -rf /root/tempdokuwiki2
  141. chown -R www-data:www-data /var/lib/dokuwiki/*
  142. # Ensure that the bundled SSL cert is being used
  143. if [ -f /etc/ssl/certs/${DOKUWIKI_DOMAIN_NAME}.bundle.crt ]; then
  144. sed -i "s|${DOKUWIKI_DOMAIN_NAME}.crt|${DOKUWIKI_DOMAIN_NAME}.bundle.crt|g" /etc/nginx/sites-available/${DOKUWIKI_DOMAIN_NAME}
  145. fi
  146. if [ -d /etc/letsencrypt/live/${DOKUWIKI_DOMAIN_NAME} ]; then
  147. ln -s /etc/letsencrypt/live/${DOKUWIKI_DOMAIN_NAME}/privkey.pem /etc/ssl/private/${DOKUWIKI_DOMAIN_NAME}.key
  148. ln -s /etc/letsencrypt/live/${DOKUWIKI_DOMAIN_NAME}/fullchain.pem /etc/ssl/certs/${DOKUWIKI_DOMAIN_NAME}.pem
  149. fi
  150. echo $"Restore of Dokuwiki complete"
  151. fi
  152. }
  153. function remove_dokuwiki {
  154. if [ ${#DOKUWIKI_DOMAIN_NAME} -eq 0 ]; then
  155. return
  156. fi
  157. function_check remove_onion_service
  158. remove_onion_service dokuwiki ${DOKUWIKI_ONION_PORT}
  159. nginx_dissite $DOKUWIKI_DOMAIN_NAME
  160. remove_certs $DOKUWIKI_DOMAIN_NAME
  161. if [ -f /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME ]; then
  162. rm /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  163. fi
  164. apt-get -y remove --purge dokuwiki
  165. if [ ! -d /var/www/$DOKUWIKI_DOMAIN_NAME ]; then
  166. rm -rf /var/www/$DOKUWIKI_DOMAIN_NAME
  167. fi
  168. if [ -d /var/lib/dokuwiki ]; then
  169. rm -rf /var/lib/dokuwiki
  170. fi
  171. if [ -d /etc/dokuwiki ]; then
  172. rm -rf /etc/dokuwiki
  173. fi
  174. if [ -d /usr/share/dokuwiki ]; then
  175. rm -rf /usr/share/dokuwiki
  176. fi
  177. remove_completion_param "install_dokuwiki"
  178. remove_completion_param "dokuwiki domain"
  179. }
  180. function get_dokuwiki_admin_password {
  181. if [ -f /home/$MY_USERNAME/README ]; then
  182. if grep -q "Dokuwiki password" /home/$MY_USERNAME/README; then
  183. DOKUWIKI_ADMIN_PASSWORD=$(cat /home/$MY_USERNAME/README | grep "Dokuwiki password:" | awk -F ':' '{print $2}' | sed 's/^ *//')
  184. fi
  185. fi
  186. }
  187. function install_dokuwiki {
  188. if [ ! $DOKUWIKI_DOMAIN_NAME ]; then
  189. return
  190. fi
  191. apt-get -y install dokuwiki
  192. apt-get -y remove --purge apache*
  193. if [ -d /etc/apache2 ]; then
  194. rm -rf /etc/apache2
  195. echo $'Removed Apache installation after Dokuwiki install'
  196. fi
  197. if [ ! -d /var/www/$DOKUWIKI_DOMAIN_NAME ]; then
  198. mkdir /var/www/$DOKUWIKI_DOMAIN_NAME
  199. fi
  200. if [ -d /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs ]; then
  201. rm -rf /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs
  202. fi
  203. ln -s /usr/share/dokuwiki /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs
  204. if [ ! -d /var/lib/dokuwiki/custom ]; then
  205. mkdir /var/lib/dokuwiki/custom
  206. fi
  207. cp /etc/dokuwiki/local.php.dist /var/lib/dokuwiki/custom/local.php
  208. if [ ! -f /etc/dokuwiki/local.php ]; then
  209. ln -s /var/lib/dokuwiki/custom/local.php /etc/dokuwiki/local.php
  210. fi
  211. chown www-data /var/lib/dokuwiki/custom
  212. chown www-data /var/lib/dokuwiki/custom/local.php
  213. chown -R www-data /etc/dokuwiki
  214. chown -R www-data /usr/share/dokuwiki/lib/
  215. chmod 600 /var/lib/dokuwiki/custom/local.php
  216. chmod -R 755 /usr/share/dokuwiki/lib
  217. sed -i 's|//$conf|$conf|g' /var/lib/dokuwiki/custom/local.php
  218. sed -i "s|joe|$MY_USERNAME|g" /var/lib/dokuwiki/custom/local.php
  219. sed -i "s|Debian Dokuwiki|$DOKUWIKI_TITLE|g" /etc/dokuwiki/local.php
  220. # set the admin user
  221. sed -i "s/@admin/$MY_USERNAME/g" /etc/dokuwiki/local.php
  222. # disallow registration of new users
  223. if ! grep -q "disableactions" /etc/dokuwiki/local.php; then
  224. echo "\$conf['disableactions'] = 'register';" >> /etc/dokuwiki/local.php
  225. fi
  226. if ! grep -q "disableactions" /var/lib/dokuwiki/custom/local.php; then
  227. echo "\$conf['disableactions'] = 'register';" >> /var/lib/dokuwiki/custom/local.php
  228. fi
  229. if ! grep -q "authtype" /var/lib/dokuwiki/custom/local.php; then
  230. echo "\$conf['authtype'] = 'authplain';" >> /var/lib/dokuwiki/custom/local.php
  231. fi
  232. if ! grep -q "authtype" /etc/dokuwiki/local.php; then
  233. echo "\$conf['authtype'] = 'authplain';" >> /etc/dokuwiki/local.php
  234. fi
  235. function_check get_dokuwiki_admin_password
  236. get_dokuwiki_admin_password
  237. if [ ! $DOKUWIKI_ADMIN_PASSWORD ]; then
  238. if [ -f $IMAGE_PASSWORD_FILE ]; then
  239. DOKUWIKI_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
  240. else
  241. DOKUWIKI_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
  242. fi
  243. fi
  244. HASHED_DOKUWIKI_PASSWORD=$(echo -n "$DOKUWIKI_ADMIN_PASSWORD" | md5sum | awk -F ' ' '{print $1}')
  245. echo -n "$MY_USERNAME:$HASHED_DOKUWIKI_PASSWORD:$MY_NAME:$MY_EMAIL:admin,user,upload" > /var/lib/dokuwiki/acl/users.auth.php
  246. chmod 640 /var/lib/dokuwiki/acl/users.auth.php
  247. if ! grep -q "video/ogg" /etc/dokuwiki/mime.conf; then
  248. echo 'ogv video/ogg' >> /etc/dokuwiki/mime.conf
  249. fi
  250. if ! grep -q "video/mp4" /etc/dokuwiki/mime.conf; then
  251. echo 'mp4 video/mp4' >> /etc/dokuwiki/mime.conf
  252. fi
  253. if ! grep -q "video/webm" /etc/dokuwiki/mime.conf; then
  254. echo 'webm video/webm' >> /etc/dokuwiki/mime.conf
  255. fi
  256. DOKUWIKI_ONION_HOSTNAME=$(add_onion_service dokuwiki 80 ${DOKUWIKI_ONION_PORT})
  257. set_completion_param "dokuwiki domain" "${DOKUWIKI_DOMAIN_NAME}"
  258. if [[ $ONION_ONLY == "no" ]]; then
  259. echo 'server {' > /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  260. echo ' listen 80;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  261. echo " root /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  262. echo " server_name $DOKUWIKI_DOMAIN_NAME;" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  263. echo ' access_log off;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  264. echo " error_log /var/log/nginx/${DOKUWIKI_DOMAIN_NAME}_error.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  265. echo ' index index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  266. echo ' charset utf-8;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  267. echo ' proxy_read_timeout 86400s;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  268. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  269. function_check nginx_disable_sniffing
  270. nginx_disable_sniffing $DOKUWIKI_DOMAIN_NAME
  271. echo ' # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  272. echo ' location / {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  273. function_check nginx_limits
  274. nginx_limits $DOKUWIKI_DOMAIN_NAME
  275. echo ' rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  276. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  277. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  278. echo " # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  279. echo ' # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  280. echo ' location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  281. echo ' allow all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  282. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  283. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  284. echo ' # statically serve these file types when possible' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  285. echo ' # otherwise fall back to front controller' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  286. echo ' # allow browser to cache them' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  287. echo ' # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  288. echo ' location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  289. echo ' expires 30d;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  290. echo ' try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  291. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  292. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  293. echo ' # block these file types' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  294. echo ' location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  295. echo ' deny all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  296. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  297. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  298. echo ' # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  299. echo ' # or a unix socket' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  300. echo ' location ~* \.php$ {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  301. function_check nginx_limits
  302. nginx_limits $DOKUWIKI_DOMAIN_NAME
  303. echo ' # Zero-day exploit defense.' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  304. echo ' # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  305. echo " # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  306. echo " # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  307. echo " # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  308. echo " # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  309. echo ' try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  310. echo ' # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  311. echo ' fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  312. echo ' # With php5-cgi alone:' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  313. echo ' # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  314. echo ' # With php5-fpm:' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  315. echo ' fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  316. echo ' include fastcgi_params;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  317. echo ' fastcgi_index index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  318. echo ' fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  319. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  320. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  321. echo ' # deny access to all dot files' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  322. echo ' location ~ /\. {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  323. echo ' deny all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  324. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  325. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  326. echo ' #deny access to store' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  327. echo ' location ~ /store {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  328. echo ' deny all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  329. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  330. echo ' location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  331. echo ' deny all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  332. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  333. echo ' location ~ /\.ht {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  334. echo ' deny all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  335. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  336. echo '}' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  337. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  338. echo 'server {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  339. echo ' listen 443 ssl;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  340. echo " root /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  341. echo " server_name $DOKUWIKI_DOMAIN_NAME;" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  342. echo ' access_log off;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  343. echo " error_log /var/log/nginx/${DOKUWIKI_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  344. echo ' index index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  345. echo ' charset utf-8;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  346. echo ' proxy_read_timeout 86400s;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  347. function_check nginx_ssl
  348. nginx_ssl $DOKUWIKI_DOMAIN_NAME
  349. function_check nginx_disable_sniffing
  350. nginx_disable_sniffing $DOKUWIKI_DOMAIN_NAME
  351. echo ' add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  352. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  353. echo ' # webmail' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  354. echo ' location /webmail {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  355. function_check nginx_limits
  356. nginx_limits $DOKUWIKI_DOMAIN_NAME
  357. echo ' rewrite ^/(.*) /webmail/index.php last;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  358. echo ' rewrite ^/(.*) /webmail/installer/index.php last;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  359. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  360. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  361. echo ' # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  362. echo ' location / {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  363. function_check nginx_limits
  364. nginx_limits $DOKUWIKI_DOMAIN_NAME
  365. echo ' rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  366. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  367. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  368. echo " # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  369. echo ' # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  370. echo ' location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  371. echo ' allow all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  372. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  373. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  374. echo ' # statically serve these file types when possible' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  375. echo ' # otherwise fall back to front controller' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  376. echo ' # allow browser to cache them' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  377. echo ' # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  378. echo ' location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  379. echo ' expires 30d;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  380. echo ' try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  381. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  382. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  383. echo ' # block these file types' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  384. echo ' location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  385. echo ' deny all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  386. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  387. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  388. echo ' # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  389. echo ' # or a unix socket' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  390. echo ' location ~* \.php$ {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  391. function_check nginx_limits
  392. nginx_limits $DOKUWIKI_DOMAIN_NAME
  393. echo ' # Zero-day exploit defense.' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  394. echo ' # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  395. echo " # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  396. echo " # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  397. echo " # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  398. echo " # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  399. echo ' try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  400. echo ' # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  401. echo ' fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  402. echo ' # With php5-cgi alone:' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  403. echo ' # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  404. echo ' # With php5-fpm:' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  405. echo ' fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  406. echo ' include fastcgi_params;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  407. echo ' fastcgi_index index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  408. echo ' fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  409. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  410. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  411. echo ' # deny access to all dot files' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  412. echo ' location ~ /\. {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  413. echo ' deny all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  414. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  415. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  416. echo ' #deny access to store' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  417. echo ' location ~ /store {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  418. echo ' deny all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  419. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  420. echo ' location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  421. echo ' deny all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  422. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  423. echo ' location ~ /\.ht {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  424. echo ' deny all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  425. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  426. echo '}' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  427. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  428. else
  429. echo -n '' > /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  430. fi
  431. echo 'server {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  432. echo " listen 127.0.0.1:${DOKUWIKI_ONION_PORT} default_server;" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  433. echo " root /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs;" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  434. echo " server_name $DOKUWIKI_ONION_HOSTNAME;" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  435. echo ' access_log off;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  436. echo " error_log /var/log/nginx/${DOKUWIKI_DOMAIN_NAME}_error_ssl.log $WEBSERVER_LOG_LEVEL;" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  437. echo ' index index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  438. echo ' charset utf-8;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  439. echo ' proxy_read_timeout 86400s;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  440. function_check nginx_disable_sniffing
  441. nginx_disable_sniffing $DOKUWIKI_DOMAIN_NAME
  442. echo ' add_header Strict-Transport-Security "max-age=0;";' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  443. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  444. echo ' # rewrite to front controller as default rule' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  445. echo ' location / {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  446. function_check nginx_limits
  447. nginx_limits $DOKUWIKI_DOMAIN_NAME
  448. echo ' rewrite ^/(.*) /index.php?q=$uri&$args last;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  449. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  450. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  451. echo " # make sure webfinger and other well known services aren't blocked" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  452. echo ' # by denying dot files and rewrite request to the front controller' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  453. echo ' location ^~ /.well-known/ {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  454. echo ' allow all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  455. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  456. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  457. echo ' # statically serve these file types when possible' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  458. echo ' # otherwise fall back to front controller' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  459. echo ' # allow browser to cache them' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  460. echo ' # added .htm for advanced source code editor library' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  461. echo ' location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|ttf|woff|svg)$ {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  462. echo ' expires 30d;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  463. echo ' try_files $uri /index.php?q=$uri&$args;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  464. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  465. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  466. echo ' # block these file types' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  467. echo ' location ~* \.(tpl|md|tgz|log|out)$ {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  468. echo ' deny all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  469. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  470. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  471. echo ' # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  472. echo ' # or a unix socket' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  473. echo ' location ~* \.php$ {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  474. function_check nginx_limits
  475. nginx_limits $DOKUWIKI_DOMAIN_NAME
  476. echo ' # Zero-day exploit defense.' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  477. echo ' # http://forum.nginx.org/read.php?2,88845,page=3' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  478. echo " # Won't work properly (404 error) if the file is not stored on this" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  479. echo " # server, which is entirely possible with php-fpm/php-fcgi." >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  480. echo " # Comment the 'try_files' line out if you set up php-fpm/php-fcgi on" >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  481. echo " # another machine. And then cross your fingers that you won't get hacked." >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  482. echo ' try_files $uri $uri/ /index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  483. echo ' # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  484. echo ' fastcgi_split_path_info ^(.+\.php)(/.+)$;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  485. echo ' # With php5-cgi alone:' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  486. echo ' # fastcgi_pass 127.0.0.1:9000;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  487. echo ' # With php5-fpm:' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  488. echo ' fastcgi_pass unix:/var/run/php5-fpm.sock;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  489. echo ' include fastcgi_params;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  490. echo ' fastcgi_index index.php;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  491. echo ' fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  492. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  493. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  494. echo ' # deny access to all dot files' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  495. echo ' location ~ /\. {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  496. echo ' deny all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  497. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  498. echo '' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  499. echo ' #deny access to store' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  500. echo ' location ~ /store {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  501. echo ' deny all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  502. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  503. echo ' location ~ /(data|conf|bin|inc)/ {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  504. echo ' deny all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  505. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  506. echo ' location ~ /\.ht {' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  507. echo ' deny all;' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  508. echo ' }' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  509. echo '}' >> /etc/nginx/sites-available/$DOKUWIKI_DOMAIN_NAME
  510. function_check create_site_certificate
  511. create_site_certificate $DOKUWIKI_DOMAIN_NAME
  512. function_check configure_php
  513. configure_php
  514. nginx_ensite $DOKUWIKI_DOMAIN_NAME
  515. systemctl restart php5-fpm
  516. systemctl restart nginx
  517. function_check add_ddns_domain
  518. add_ddns_domain $DOKUWIKI_DOMAIN_NAME
  519. # add some post-install instructions
  520. if ! grep -q $"Dokuwiki password" /home/$MY_USERNAME/README; then
  521. echo '' >> /home/$MY_USERNAME/README
  522. echo '' >> /home/$MY_USERNAME/README
  523. echo $'Dokuwiki' >> /home/$MY_USERNAME/README
  524. echo '========' >> /home/$MY_USERNAME/README
  525. echo $"Dokuwiki onion domain: ${DOKUWIKI_ONION_HOSTNAME}" >> /home/$MY_USERNAME/README
  526. echo $"Dokuwiki username: $MY_USERNAME" >> /home/$MY_USERNAME/README
  527. echo $"Dokuwiki password: $DOKUWIKI_ADMIN_PASSWORD" >> /home/$MY_USERNAME/README
  528. echo '' >> /home/$MY_USERNAME/README
  529. echo $'Once you have set up the dokuwiki then remove the install file:' >> /home/$MY_USERNAME/README
  530. echo '' >> /home/$MY_USERNAME/README
  531. echo " rm /var/www/$DOKUWIKI_DOMAIN_NAME/htdocs/install.php" >> /home/$MY_USERNAME/README
  532. echo '' >> /home/$MY_USERNAME/README
  533. chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/README
  534. chmod 600 /home/$MY_USERNAME/README
  535. fi
  536. APP_INSTALLED=1
  537. }
  538. # NOTE: deliberately no exit 0