$ sudo add-apt-repository ppa:nginx/stable $ sudo apt update $ sudo apt install nginx php-fpm
$ sudo systemctl enable nginx
$ sudoedit /etc/nginx/sites-available/default
server{…}
内を以下に変更する。
server_tokens off;
root /var/www/html;
location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ @dokuwiki; }
#Remember to comment the below out when you're installing, and uncomment it when done. location ~ /(data/|conf/|bin/|inc/|install.php) { deny all; } location ~ ^/lib.*\.(js|css|gif|png|ico|jpg|jpeg)$ { expires 365d; } 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/php7.0-fpm.sock; # fastcgi_pass unix:/var/run/php5-fpm.sock; #old php version }
$ sudoedit .htaccess
<Files ~ "^([\._]ht|README$|VERSION$|COPYING$)"> Order allow,deny Deny from all </Files> RewriteEngine on RewriteRule ^_media/(.*) lib/exe/fetch.php?media=$1 [QSA,L] RewriteRule ^_detail/(.*) lib/exe/detail.php?media=$1 [QSA,L] RewriteRule ^_export/([^/]+)/(.*) doku.php?do=export_$1&id=$2 [QSA,L] RewriteRule ^$ doku.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) doku.php?id=$1 [QSA,L] RewriteRule ^index.php$ doku.php RewriteBase / # sub.example.com #RewriteBase /test/site # example.com/test/site/ #RewriteBase /test/dokuwiki # example.com/test/dokuwiki/
$ sudo systemctl restart nginx
$ sudo systemctl restart php7.0-fpm
/etc/nginx/sites-available/default
内の PHP の設定が間違っている。$ chmod -R 777 data $ chmod 777 conf $ chmod 666 conf/*
$ chown -R 777 data $ chown -R www-data. conf
インストール方法のパーミッションの変更を行う。
$ chmod 777 lib/tpl
$ chown -R www-data. lib/tpl
$ chmod 777 lib/plugins
$ chown -R www-data. lib/plugins
lib/tpl/テンプレート名/images
) 以下に favicon.ico や logo.png があるので、それを置き換える%%
で囲む%%--%%
FastCGI-stderr: PHP Fatal error: Uncaught Error: Call to undefined function utf8_decode()
がある場合、php7 側の問題 (utf8_decode() が別パッケージに分離されたのが原因) らしい$ sudo apt-get install php7.0-xml