WinNMP - portable Nginx MariaDB Redis Php development stack for Windows

A portable, preconfigured, lightweight, fast and stable server stack for developing php mysql applications on windows, based on the excellent webserver Nginx. A lighter alternative to XAMPP and WAMP.

How to create a new Project

New Project

Need some help? Hire a freelance PHP / Linux expert for your project!

  • Open WinNMP Manager by clicking the taskbar or desktop icon, then click on New Project icon, choose a project name like myProjectName, hit Enter or click Save Project
  • Accept the User Account Control warning about WinNMP.exe. This is required to map the domain name myProjectName.test to localhost, for testing SEF links and other Nginx rewrite rules.
  • Set the project Live Url if any. This should point to the production version of your project, hosted on a remote server.
  • Click Save to close the Edit Project window
  • Type in your browser http://myProjectName.test
  • Add PHP files in c:\WinNMP\WWW\myProjectName folder.
  • The project database myProjectName and MariaDB user myProjectName are already created automatically
  • The default MariaDb(MySql) host is localhost with username root and no password.
    MySql server:       'localhost'
    MySql user:         'root' or 'myProjectName'
    MySql password:     '' (no password)
    MySql database:     'myProjectName'
  • The default Redis host is localhost port 6379
  • Read our tutorials on How to install Joomla, Magento 2 or Wordpress on Windows
  • Upload or Sync the project files to the remote server, as explained below.

    Edit Project

How to upload files or synchronize your project to a server using WinSCP:

Project Buttons

  • In the Projects list, click Project Setup Project Setup
  • Setup the remote connection and Save.
  • Return to the project list and click on Synchronize or Browse icons. A WinSCP dialog will open.

    Sync with WinSCP

    Browse Files with WinSCP

How to use COMPOSER:

Composer

Composer is a tool for dependency management in PHP used to download and keep updated various PHP frameworks and components. After you created a new project in c:\pathTo\WWW\myProjectName, click on Open Command Prompt icon Open Command Prompt, then run commands like:

composer create-project silverstripe/installer myProjectName 3.1.*

composer create-project laravel/laravel myProjectName --prefer-dist

cd myProjectName
composer require components/jquery
composer require components/bootstrap-datetimepicker

cd myProjectName
composer create-project symfony/framework-standard-edition

How to change the root directory of a project:

Your project's Nginx settings are stored in conf\domains.d\myProjectName.conf. This file`s root directive is automatically modified by the WinNMP manager for portability.

If you want to use a custom root folder for your project, for example WWW\myProjectName\public, you can manually set this root directive and lock it using the comment # locked

    root "C:\PathTo\WWW\myProjectName\public"; # locked

How to send emails using PHP

WinNMP has 2 options for processing emails sent by PHP's mail() function: mSmtp and mailToDisk (default). To change the option, edit conf\php.ini and modify sendmail_path:

  • For Development use mailToDisk (the default): sendmail_path = '"C:/WinNMP/bin/php" -n -f "C:/WinNMP/include/tools/mailtodisk.php" --' Emails will be saved to log\mail-XX.eml

  • For Production use mSmtp: sendmail_path = '"C:/WinNMP/bin/msmtp/msmtp.exe" -C "C:/WinNMP/conf/msmtp.ini" -t' You also need to edit conf\msmtp.ini in order to configure SMTP server options

How to allow access from LAN and Internet to your local project:

In the Projects list, click Project Setup, check Enable Local Virtual Server, then Save.

Edit WinNMP\conf\domains.d\projectName.conf directly or click on Edit Nginx Virtual Server button in the Edit Project window Edit Nginx Local Virtual Server

Modify like this:

server {
    listen      127.0.0.1:80;
    listen          *:80;       

    server_name     projectName.test projectName.com projectName.myDomain.com;

    ### Access Restrictions
    allow           all;
    ## deny         all;

Now click on Reload Nginx button.

Enable self signed SSL certificate for your local project:

Self Signed SSL certificates are usefull only for local development, browsers do not tust them but exceptions can easily be added. Starting with version 19.07, WinNMP includes OpenSSL and for each project with Local Virtual Server enabled, a self-signed SSL certificate is generated (when the project is saved) in conf\opensslCA\selfsigned. However, the certificate is not enabled by default in Nginx.

In order to enable it, in the Projects list, click Project Setup, check Enable Local Virtual Server, then Save.

Edit WinNMP\conf\domains.d\projectName.conf directly or click on Edit Nginx Virtual Server button in the Edit Project window Edit Nginx Local Virtual Server

Uncomment or add the lines :

    listen      127.0.0.1:443 ssl http2;
    ssl_certificate_key  opensslCA\selfsigned\projectName.test.key;
    ssl_certificate      opensslCA\selfsigned\projectName.test.crt;

Now click on Reload Nginx button. In your browser visit/bookmark the SSL version of the virtual server: https://projectName.test , you will get a security warning. Click Advanced and Accept the risk and continue

How to add additional local test server names to my project:

Hosts File Editor

You can always use different/multiple server names for your Local Virtual Server. Use Hosts File Editor (the third icon) to add extra local server names like:

127.0.0.1    projectName.dev
127.0.0.1    www.projectName.xyz

Apply changes in Hosts File Editor: CLICK SAVE - (CTRL-S) and File>Exit (ALT-F4)

Then Edit conf\domains.d\projectName.conf and ADD below the existing server_name projectName.test;

server_name projectName.dev www.projectName.xyz;

Apply Changes to Nginx: Save the file and kill/start Nginx

How to add locations

If you want a location like /phpMyAdmin to serve files from a directory outside your project (but inside PHP's open_basedir), for example C:/WinNMP/include/phpMyAdmin you need to edit the Nginx config file:

Edit WinNMP\conf\nginx.conf to set http://localhost/phpMyAdmin

server {
    ....
    location ~ ^/phpMyAdmin/.*\.php$ {
            root "C:/WinNMP/include";
            try_files $uri =404;
            include         nginx.fastcgi.conf;
            fastcgi_pass    php_farm;
            allow           127.0.0.1;
            allow           ::1;
            deny            all;
    }
    location ~ ^/phpMyAdmin/ {
             root "C:/WinNMP/include";
    }
}

Notice that the root directive lacks /phpMyAdmin because Nginx adds the URL path /phpMyAdmin to the root path, so the resulting directory is C:/WinNMP/include/phpMyAdmin