Windows

OWI (Organizr Windows Installer)

Requirements

Currently x64 bit OS only.

  • Latest version of PowerShell, if you're on Windows 7/Win Server 2008 download
  • Windows 10 recommended but it should work on Windows 7 if you have the latest version of PowerShell
  • The user account running the installer should have admin privileges and a password set.

Tested on

  • Windows 10 Pro (Fall creators update)
  • Windows Server 2012 R2

What does it do

  • Downloads Nginx, PHP, NSSM and Visual C++ Redistributable
  • Creates services for Nginx and PHP
  • Downloads Organizr
  • Configures PHP as per Org requirements
  • Adds in a working Nginx conf file with PHP block enabled

Installation Steps

  1. Clone\Download the OWI folder from: https://github.com/elmerfdz/OrganizrInstaller
  2. Extract the zip file to your desktop
  3. Navigate to \OrganizrInstaller\windows\owi.
  4. Right-click on owi_installer.bat and click on Run as administrator
  5. Installer will ask you for the nginx install location, type in the full path as per the e.g. c:\nginx
  6. The installer will ask you to provide the password of the current user during installation, the nginx service requires that you run it under a user account instead of the 'Local System' account, if you don't then you won't be able to save and reload your nginx config

Manual Install

Installing Nginx & Running it as a Service

  1. Install Nginx
    1. Download Nginx from: http://nginx.org/en/download.html
    2. Install Nginx to your preferred location
    3. Copy the Nginx folder to your preferred location e.g. c:\
    4. If you want to run Nginx as a service then go the 'Running Nginx as a service' section, if not continue.
    5. Go to the location you copied the Nginx folder e.g. c:\nginx
    6. Double click on 'nginx.exe' in c:\nginx , nginx should now be running on your system
    7. To verify, open a browser and type localhost and press enter. If you get "Welcome to nginx!” message then Nginx has been installed successfully
      1. Note: you would need to open 'nginx.exe' every time you reboot your system, to avoid this, install Nginx as a service.
  2. Running Nginx as a service
    1. Download NSSM from: https://nssm.cc/download
    2. Copy the nssm.exe from the win32 or win64 folder depending on your system to C:\Windows\System32
    3. Open cmd as admin, navigate to C:\Windows\System32
    4. Type in this command without the quotes “nssm install nginx”
      1. Path = C:\nginx\nginx.exe
      2. Startup directory = C:\nginx
      3. h21f0uB.png
    5. Install service
    6. Make sure you run the service as the admin account
      1. Open run and type in services.msc
      2. Search for the nginx service we just installed
      3. Double-click and go to the Log On tab
      4. Select ‘This account:’ and fill in your account details and then press ok.
      5. Right click on the nginx service and restart
    7. Making your Nginx install PHP ready, uncomment the following code from your nginx.conf file (c:\nginx\conf\nginx.conf)
location ~ \.php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

To verify, open a browser and type localhost and press enter. If you get "Welcome to nginx!” message then Nginx has been installed successfully

Installing PHP & Running as a service on Windows

  1. Installing PHP for Windows
    1. Download PHP for Windows from here: http://windows.php.net/download (Non Thread Safe version used in this guide)
    2. Create a folder called PHP under your Nginx directory e.g. C:\nginx\php and copy the downloaded files to this folder
  2. Running PHP as a service
    1. Install NSSM by following steps 1 & 2 from Above
    2. If you’ve got ‘nssm’ already setup, open command prompt as admin.
    3. Type in the following cmd without the quotes “nssm install php”
      1. Path = C:\nginx\php\php-cgi.exe
      2. Startup directory = C:\nginx\php
      3. Arguments = -b 127.0.0.1:9000
      4. KTKCbDs.png
    4. Install Service
    5. On the opened cmd prompt type in “nssm start php” (without the quotes) to start the PHP service.
    6. If the installed PHP service doesn’t start, then try manually running the ‘php-cgi.exe’ file in C:\nginx\php\ , If you get a missing ‘VCRUNTIME’ related error then follow the solution on this link: http://stackoverflow.com/questions/30811668/php-7-missing-vcruntime140-dll
    7. Make a copy of one of the php.ini-development or php.ini-production files and rename it to php.ini
    8. Open the php.ini file and search for the following and uncomment each:
      1. extension_dir = "ext"
      2. extension=php_openssl.dll
      3. extension=php_pdo_sqlite.dll
      4. extension=php_curl.dll
      5. extension=php_sqlite3.dll
    9. Please note that if you are running PHP 7.2 or higher, look for the below lines and uncomment them instead:
      1. extension_dir = "ext"
      2. extension=openssl
      3. extension=pdo_sqlite
      4. extension=curl
      5. extension=sqlite3
    10. Also, uncomment the following line and add "ext" to the end of it:
      1. sqlite3.extension_dir =
        1. So that is becomes: "sqlite3.extension_dir = ext" (without the quotes)
    11. On the opened cmd prompt type in “nssm restart php” (without the quotes) to restart the PHP service to apply the changes in php.ini.

Installing Organizr

  1. Make sure you have setup Nginx and PHP
  2. Make sure you have enabled php_pdo_sqlite.dll & php_openssl.dll PHP extensions.
  3. Download the latest release of Organizr.
  4. Open the downloaded organizr zip file and copy all files and paste them in the web root folder c:\nginx\html\
    1. OR If you prefer you can create sub-directory called organizr under c:\nginx\html and paste the copied organizr files in that folder.
  5. Goto http(s)://localhost/index.php

Sample Config Files

Nginx.conf

You can copy the following if you wish and replace the content in your nginx.conf file

#user  nobody;
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        #CHANGE THESE LINES##########
        server_name  localhost;
        root   html/Organizr;
        #############################
        index  index.php index.html index.htm;
        error_page 400 401 403 404 405 408 500 502 503 504  /?error=$status;
        location / { }
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

    }

}