LoginSignup
4
1

More than 5 years have passed since last update.

[インストール]windows + nginx + php + pukiwiki

Last updated at Posted at 2018-10-14

はじめに

 情報共有の場が必要になり手軽に情報更新ができるのでwikiを導入することした。
 合う合わないがあるので、いったんローカルPCにインストールする。

各種インストール

準備(ダウンロード)

 まずは各ソフトを以下のリンクからダウンロード

  • nginx

  nginx: download
  → nginx/Windows-1.15.5 を選択

  • php

  PHP: Downloads
  → VC15 x64 Thread Safe のzip(php-7.2.9-Win32-VC15-x64.zip) を選択

  • pukiwik

  PukiWiki 1.5.1
  → pukiwiki-1.5.1_utf8.zip を選択

インストール

  • nginx

  zipファイルを解凍
  C:\dev\nginx-1.15.5
 
  解凍したディレクトリに起動スクリプト停止スクリプトを準備
  ・起動スクリプト

start.bat
@echo off

set BASE_DIR=%~dp0
cd %BASE_DIR%
start nginx
echo 起動しました
pause

  ・終了スクリプト

stop.bat
@echo off

set BASE_DIR=%~dp0
cd %BASE_DIR%
nginx -s quit
echo 停止しました
pause
  • php

  ・zipファイルを解凍
    C:\dev\php-7.2.9-Win32-VC15-x64
  ・windowsのシステム環境変数のpathにphpのディレクトリを登録

  • pukiwiki

  ・zipファイルを解凍
    C:\dev\nginx-1.15.5\html\wiki

設定

  nginx wiki を見ながら設定しました。

1. RunHiddenConsole をダウンロード

 →リンクをクリックしてダウンロードして、nginxのフォルダに解凍
  C:\dev\nginx-1.15.5\RunHiddenConsole.exe

2. nginx と php を連携

start-php-fcgi.bat
@ECHO OFF
C:\dev\nginx-1.15.5\RunHiddenConsole.exe php-cgi.exe -b 127.0.0.1:9123
pause

3.nginxの設定

nginx.conf
    server {
        listen       1080;
        server_name  DESKTOP-PC;  # localhost → マシン名に変更

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9123;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }

4.起動
 ・start-php-fcgi.bat を実行
 ・start.bat

5.動作確認

 ・PHP
   →テスト用ファイル作成
    C:\dev\nginx-1.15.5\html\index.php

index.php
<?php
phpinfo();

  → ブラウザでアクセス
   http://localhost:1080/index.php

 ・pukiwiki
  → ブラウザでアクセス
   http://localhost:1080/wiki/index.php

  → メニューのURLを確認
   ※新規作成をクリック
    nginx.confのserver_nameに設定した値がドメイン部分に設定されている
     http://desktop-pc:1080/wiki/index.php?plugin=newpage&refer=FrontPage

トラブルメモ

 nginx.confのserver_nameに設定をしていないとデフォルトのlocalhost にしていると
 wikiのメニューがlocalhostになっていて、
 他のPCからアクセスした場合、新規ページ作成リンクをクリックすると404:NotFoundになってしまった。
 忘れずに設定すること。

その他

 まだ本格的に使い始めていないので、設定漏れがあるかもしれない。
 徐々に確認して、必要であれば更新をしていく。 

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1