Knowledgebase
emscom > emscom Help Desk > Knowledgebase

Search help:


Install NGinX and PHP on Windows

Solution

64 Bit thread safe versions

1. Download resources

  • Download the Netbeans installer apache-NetBeans14.exe, with pre-packaged JDK18 from Codelerity
    https://www.codelerity.com/netbeans/
  • Download PHP interpreter php-7.4.30-Win32-vc15-x64.zip
    https://windows.php.net/download
  • Download NGinX web server nginx-1.21.6.zip
    http://nginx.org/en/download.html
  • Download the NSSM Windows service installation utility
    https://nssm.cc/download

2. Create file system folder c:\dev

Unzip PHP to c:\dev\php

Unzip NGinX to c:\dev\nginx

Copy nssm.exe to c:\dev

3. Create nginx services. From an admin command

nssm.exe install nginx

  • Application>Path: c:\dev\nginx\nginx.exe
  • Application>Startup directory: c:\dev\nginx
  • Details>Display Name: nginx
  • Details>Description: NGinX web server
  • Details>Startup type: Automatic
  • Log on>Log on as: Local System account
  • I/O>input (stdin): start nginx.exe
  • Click Install Service

4. Create php service. From an admin command

nssm.exe install php-cgi

  • Application>Path: c:\dev\php\php-cgi.exe
  • Application>Startup directory: c:\dev\php
  • Application>Arguments: -b localhost:9123 --php-ini c:\dev\php.ini
  • Details>Display Name: php-cgi
  • Details>Description: fast-cgi php loader
  • Details>Startup type: Automatic
  • Log on>Log on as: Local System account
  • I/O>input (stdin): start php-cgi.exe
  • Click Install Service

 

5. Copy c:\dev\php\php-development to c:\dev\php.ini

6.  Use the Windows service manager (services) to test the services start and restart cleanly

7. Edit c:\dev\nginx\conf\nginx.conf server block as follows

    server {
listen 80;
server_name localhost;
charset utf-8;

root c:/dev/nginx/html;
location / {
index index.html index.htm;
}

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

5. Restart the nginx service to reload the conf file

6. Create c:\dev\nginx\html\phpinfo.php

 <?php 
phpinfo();
?>

7. Using a web browser load the test file http://localhost/phpinfo.php and check the php.ini path is correct

8. Install Netbeans

-p

 

 
Was this article helpful? yes / no
Related articles Install Netbeans for PHP development on Windows
Install PHP composer
modoboa letsencrypt renewal failure
Synology error pages
ESXi 6 Remote upgrade
Article details
Article ID: 181
Category: Dev
Date added: 19-06-2022 17:47:39
Views: 252
Rating (Votes): Article not rated yet (0)

 
« Go back

 
Powered by Help Desk Software HESK, in partnership with SysAid Technologies