DokuWiki

It's better when it's simple

ユーザ用ツール

サイト用ツール


ja:install:nginx

nginx と Dokuwiki

Windows 上の nginx と Dokuwiki

Ubuntu Linux 上の nginx と Dokuwiki

この構成は、Ubuntu 10.04 と (X)Ubuntu12.04 のバージョンでテストしました。 以下のパッケージがインストールされていることを確認してください:

  • nginx
  • php5-cgi

/etc/nginx/nginx.conf を編集します:

FIXME location ~ ^/dokuwiki/(data|conf|bin|inc)/ { # secure DokuWiki によって確保されているので、最後の3行は不要っぽいです。

user www-data www-data;
#(...)
 
http {
  #(...)
 
  server{
    #listen 80;
    index index.html index.php doku.php;
    #make sure a global root is defined here
    #root   /var/www/     #adapt please
 
    location ~ ^/dokuwiki/(data|conf|bin|inc)/ {   # secure DokuWiki
      deny all;
    }
    location ~ /\.ht            { deny all; } #Deny Access to htaccess-Files for Apache
 
    location ~ ^/dokuwiki/.*\.php$ {
      root           /usr/share/dokuwiki;    #adapt if needed     
      include        fastcgi_params;
      fastcgi_pass   unix:/tmp/php-fastcgi.socket;
      fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
      fastcgi_param  PATH_INFO        $uri;  #necessary for URL rewrite
    }
 
    # serve static files
    location ~ ^/dokuwiki/lib/^((?!php).)*$  {
      root         /usr/share/dokuwiki/lib;   #adapt if needed
      expires 30d;
    }
  }
}

FastCGI を起動するために、以下の内容の php-fastcgi.conf ファイルを作成します(sudo gedit /etc/init/php-fastcgi.conf):

description "php-fastcgi - keep up php-fastcgi"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec /usr/bin/sudo -u www-data PHP_FCGI_CHILDREN=2 PHP_FCGI_MAX_REQUESTS=125 /usr/bin/php-cgi -q -b /tmp/php-fastcgi.socket

再起動(fastcgi と nginx は自動的に実行される)するか、手動テストのために以下のコマンドを使います:

  • fastcgi の開始: sudo /sbin/start php-fastcgi
  • fastcgi の状態確認: sudo /sbin/status php-fastcgi
  • fastcgi の再起動: pgrep php-cgi;echo;sudo pkill php-cgi;sleep 1; sudo /sbin/start php-fastcgi; pgrep php-cgi
  • nginx の再起動: sudo /etc/init.d/nginx restart

注:If you see the error “No input file specified” エラーの場合、アクセス許可の問題かもしれません。 fastcgi と nginx は同じユーザー(上記の www-data)で実行してください。 ファイルパーミッションが正しいことを確認して下さい。

ja/install/nginx.txt · 最終更新: 2014-02-16 08:50 by 125.55.214.60

特に明示されていない限り、本Wikiの内容は次のライセンスに従います: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki