Created
September 20, 2014 03:36
-
-
Save alghanmi/a61d42e97406d683f27e to your computer and use it in GitHub Desktop.
Dokuwiki Setup
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
#!/bin/bash | |
##Install some extra packages for FPM | |
sudo aptitude install php5-fpm php5-gd php5-mcrypt | |
##Tigten PHP security | |
#Disable path info | |
sudo cp /etc/php5/fpm/php.ini /etc/php5/fpm/php.ini.default | |
sudo sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php5/fpm/php.ini | |
#Change PHP to use sockets instead of ports --already done by default in Debian & Ubuntu | |
sudo sed -i 's/listen = .*/listen = \/var\/run\/php5-fpm.sock/' /etc/php5/fpm/pool.d/www.conf | |
##Download the latest DokuWiki from the website: | |
## http://download.dokuwiki.org/ | |
sudo tar zxvf dokuwiki-*.tgz -C /home/www/wiki | |
sudo chown -R www-data:www-data /home/www/wiki | |
##Setup NginX |
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
server { | |
listen 80; | |
server_name example.com; | |
access_log /home/www/example.com/logs/access.log; | |
error_log /home/www/example.com/logs/error.log warn; | |
index index.html index.htm; | |
root /home/www/example.com/public_html; | |
location /wiki { | |
root /home/www/; | |
index index.php doku.php index.html index.htm; | |
#Secure DokuWiki | |
location ~ /(data|conf|bin|inc)/ { deny all; } | |
location ~ /(install.php|\.ht) { deny all; } | |
#Serve non-php files directly from NginX | |
location ~ /lib/^((?!php).)*$ { | |
expires 30d; | |
} | |
#Connection with PHP5 FPM | |
location ~ \.php$ { | |
include fastcgi_params; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param PATH_INFO $uri; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment