Ws
Application Stacks Azure

WAMP Stack on Windows Server 2025 on Azure User Guide

| Product: WAMP Stack on Windows Server 2025

Overview

This guide covers the deployment and use of the WAMP Stack on Windows Server 2025 on Microsoft Azure, using cloudimg's virtual machine image from the Azure Marketplace.

WAMP is the Windows form of the LAMP stack: the Apache HTTP Server, the PHP language and the MariaDB database on one server, ready for PHP applications such as content management systems, forums and custom sites. On this image Apache serves your site over HTTPS from the first boot of your VM, PHP runs inside Apache as a module, and MariaDB listens on this machine only. Every VM makes its own TLS key and certificate and its own MariaDB root password when it first starts, so no two VMs share a secret.

The image is Microsoft Windows Server 2025 Datacenter with the Desktop Experience (the full graphical interface), Gen2, x64, built from Microsoft's own image on the Azure Marketplace (MicrosoftWindowsServer:WindowsServer:2025-datacenter-g2, version 26100.33828.261112). The Windows Server licence is included in the VM price and billed by Microsoft.

What's included:

  • Apache HTTP Server 2.4.71 for Windows (64-bit), the Apache Lounge build (Visual Studio 2026, OpenSSL 3.5.9), in C:\Program Files\Apache24\
  • PHP 8.5.13, the PHP project's own thread safe (ZTS) Windows build, in C:\Program Files\PHP\, loaded into Apache as a module (php8apache2_4.dll) with OPcache on and 11 extensions: mysqli, pdo_mysql, openssl, mbstring, curl, intl, gd, zip, sodium, fileinfo and exif
  • MariaDB Server 11.8.10 (a long-term support release), in C:\Program Files\MariaDB 11.8\, its data in C:\ProgramData\MariaDB\data
  • Each download's checksum verified when the image was built, and the Microsoft Visual C++ runtime that Apache and PHP need, from Microsoft's own signed installer
  • Apache running as the Windows service Apache2.4 under its own virtual service account NT SERVICE\Apache2.4, and MariaDB as the service MariaDB under NT SERVICE\MariaDB: never LocalSystem, both started at boot and restarted if they stop
  • HTTPS on port 443 with HTTP/2, using this VM's own 3072-bit RSA key and self-signed certificate, made at the first boot of your VM; HTTP on port 80 redirects every request (301) to HTTPS; TLS 1.2 and TLS 1.3 only
  • MariaDB bound to 127.0.0.1:3306 only, with a root password made at the first boot of your VM, no anonymous accounts, no root from other machines, no test database and LOAD DATA LOCAL off. The password is in C:\ProgramData\WAMP\wamp-credentials.txt, readable by administrators only
  • PHP's production settings: errors logged, not shown; the PHP version not advertised; secure, HTTP-only session cookies
  • Hardened Apache defaults: the Server header says only Apache (no version, no operating system), no server signature on error pages, TRACE refused, no directory listings, no /cgi-bin/
  • Windows Firewall rules Apache HTTP Server (HTTP-In) and Apache HTTP Server (HTTPS-In), allowing ports 80 and 443 in for httpd.exe. No rule opens MariaDB
  • Windows Server 2025 Datacenter, Desktop Experience, version 24H2, build 26100.33828, with Microsoft's November 2026 cumulative update. Windows Update ran during the build and reported nothing pending when the image was captured on 3 December 2026
  • The Azure VM agent, so Azure features such as Reset password and Run command work
  • Accelerated networking supported (on sizes that offer it), Trusted Launch and NVMe sizes supported
  • cloudimg's support team is on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours

Platform: Microsoft Azure (Gen2 Hyper-V; Trusted Launch, NVMe and accelerated networking supported) Administrator account: the user name and password you choose when you deploy the VM. There is no default Windows password on this image. MariaDB root password: made at the first boot of your VM, in C:\ProgramData\WAMP\wamp-credentials.txt (Step 6) Configuration: C:\Program Files\Apache24\conf\extra\httpd-cloudimg.conf (PHP, the HTTP and HTTPS sites), C:\Program Files\PHP\php.ini and C:\ProgramData\MariaDB\data\my.ini

Prerequisites

  1. An Azure subscription
  2. A Remote Desktop client: Remote Desktop Connection (mstsc) on Windows, Windows App (formerly Microsoft Remote Desktop) on macOS, or Remmina on Linux
  3. The public IP address of the machine you will connect from, so you can allow Remote Desktop from that address only

Recommended size: Standard_B2ms (2 vCPUs, 8 GiB memory). Choose a larger size for a busy site or a large database.

Step 1: Deploy the Virtual Machine

Option A: Azure Portal

  1. In the Azure Marketplace, search for "WAMP Stack on Windows Server 2025 cloudimg"
  2. Select the offer and click Create
  3. Configure the basics:
  4. Subscription and Resource group: select or create
  5. Virtual machine name and Region: your choice
  6. Size: Standard_B2ms recommended
  7. Under Administrator account, enter a Username and a Password that you choose. Azure refuses reserved names such as "administrator", "admin" and "guest"
  8. Under Inbound port rules, allow RDP (3389), HTTPS (443) and HTTP (80). Azure opens all three to the whole internet; ports 443 and 80 are meant to be public for a web server, but restrict 3389 straight after deployment (step 7). MariaDB needs no inbound port
  9. Click Review + create, then Create
  10. When the deployment finishes, open the VM's Networking (Network settings) page and edit the inbound rule for port 3389: set Source to My IP address (or your office or VPN address range)

Note the VM's Public IP address on its Overview page.

Option B: Azure CLI

Accept the offer terms once per subscription, then create the VM with no inbound rules. Leave out --admin-password and the CLI asks for the password, which keeps it out of your shell history:

az vm image terms accept --urn cloudimg1647283583153:wamp-stack-windows-server:default:latest

az vm create \
  --resource-group myResourceGroup \
  --name my-wamp \
  --image cloudimg1647283583153:wamp-stack-windows-server:default:latest \
  --size Standard_B2ms \
  --admin-username <your-admin-name> \
  --public-ip-sku Standard \
  --nsg-rule NONE

Then allow Remote Desktop from your own address only, HTTPS and HTTP from anywhere, and read the VM's public address:

az network nsg rule create \
  --resource-group myResourceGroup \
  --nsg-name my-wampNSG \
  --name allow-rdp-from-my-ip \
  --priority 1000 \
  --direction Inbound --access Allow --protocol Tcp \
  --destination-port-ranges 3389 \
  --source-address-prefixes <your-public-ip>/32

az network nsg rule create \
  --resource-group myResourceGroup \
  --nsg-name my-wampNSG \
  --name allow-web \
  --priority 1010 \
  --direction Inbound --access Allow --protocol Tcp \
  --destination-port-ranges 443 80 \
  --source-address-prefixes Internet

az vm show -d --resource-group myResourceGroup --name my-wamp --query publicIps -o tsv

While you are still building your site, use --source-address-prefixes <your-public-ip>/32 in the second rule too, and open it to Internet when you go live.

Step 2: Connect with Remote Desktop

  1. Open your Remote Desktop client and connect to the VM's public IP address
  2. Windows: run mstsc, enter the IP address and click Connect
  3. macOS: in Windows App, add a PC with the IP address
  4. Linux: in Remmina, create an RDP connection to the IP address
  5. When asked for credentials, sign in as <vm-name>\<your-admin-name> with the password you set at deployment. On Windows, choose More choices, then Use a different account
  6. Accept the certificate warning: the VM uses a self-signed Remote Desktop certificate

Windows may show its privacy settings screen at your first sign-in; choose your settings and click Accept.

The stack does not need you to stay signed in: Apache and MariaDB run as Windows services from the moment the VM starts, each under its own virtual account, and show in Services (services.msc) as Apache2.4 and MariaDB.

Windows PowerShell over Remote Desktop: the Apache2.4 and MariaDB services Running and Automatic, each under its own NT SERVICE account, httpd listening on ports 80 and 443 and MariaDB on 127.0.0.1:3306 only, with the Apache 2.4.71, PHP 8.5.13 and MariaDB 11.8.10 versions

Step 3: Check that the stack is running

Open Windows PowerShell as administrator (right-click the Start button, then Terminal (Admin)) and run:

Get-Content C:\ProgramData\WAMP\cloudimg-firstboot.done
Get-CimInstance Win32_Service -Filter "Name='Apache2.4' OR Name='MariaDB'" | Format-Table Name, State, StartMode, StartName -AutoSize
Get-NetTCPConnection -State Listen -LocalPort 80, 443, 3306 | Sort-Object LocalPort | Format-Table LocalAddress, LocalPort, @{n='Process';e={(Get-Process -Id $_.OwningProcess).ProcessName}} -AutoSize
& 'C:\Program Files\Apache24\bin\httpd.exe' -v
php -v
mariadb --version
& 'C:\Program Files\Apache24\bin\httpd.exe' -t 2>&1 | ForEach-Object { "$_" }
done 2026-12-03T17:53:52.3762240Z cert_sha256=ce9137c689235c7041e2c277fe4a91ee14a70d59dd079beddca3735564260e01

Name      State   StartMode StartName
----      -----   --------- ---------
Apache2.4 Running Auto      NT SERVICE\Apache2.4
MariaDB   Running Auto      NT SERVICE\MariaDB

LocalAddress LocalPort Process
------------ --------- -------
::                  80 httpd
0.0.0.0             80 httpd
0.0.0.0            443 httpd
::                 443 httpd
127.0.0.1         3306 mysqld

Server version: Apache/2.4.71 (Win64)
Apache Lounge VS18 Server built:   Nov 11 2026 08:56:23

PHP 8.5.13 (cli) (built: Nov 18 2026 01:01:49) (ZTS Visual C++ 2022 x64)
Copyright (c) The PHP Group
Built by The PHP Group
Zend Engine v4.5.13, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.13, Copyright (c), by Zend Technologies

C:\Program Files\MariaDB 11.8\bin\mariadb.exe from 11.8.10-MariaDB, client 15.2 for Win64 (AMD64), source revision d04ba7c69bc7fa1719cfc4b8c6393a6d8529b755

Syntax OK
  • The first line is written when the one-time first-boot task has made this VM's MariaDB instance and certificate and checked that the stack answers; cert_sha256 is your VM's own certificate fingerprint, so it differs on every VM
  • MariaDB listens on 127.0.0.1 only, so nothing outside the VM can reach it. Its process shows as mysqld: MariaDB's Windows service starts the server through mysqld.exe
  • php and mariadb work in any new PowerShell window: the image puts PHP's and MariaDB's bin folders on the system PATH
  • httpd -t checks Apache's configuration: Syntax OK

Windows PowerShell over Remote Desktop: both services Running and Automatic under their own virtual accounts, httpd on 80 and 443 and mysqld on 127.0.0.1:3306, Apache 2.4.71, PHP 8.5.13 with OPcache, MariaDB 11.8.10 and Syntax OK

Step 4: See HTTPS, PHP and the redirect

The image includes curl.exe in Apache's bin folder (Windows' own curl.exe cannot pin a certificate file). Ask Apache for its page over HTTPS, trusting exactly this VM's certificate, read the lines PHP wrote into it, then try plain HTTP, TLS 1.3 and the old TLS 1.1:

$curl = 'C:\Program Files\Apache24\bin\curl.exe'
& $curl -sI --cacert C:\ProgramData\Apache24\server.crt https://localhost/
(& $curl -s --cacert C:\ProgramData\Apache24\server.crt https://localhost/) -match 'WAMP stack is running|rendered it|extensions loaded|OPcache' -replace '<[^>]+>', ''
& $curl -sI http://localhost/docs/?page=2
& $curl -s -o NUL --tlsv1.3 --cacert C:\ProgramData\Apache24\server.crt -w "TLS 1.3 -> HTTP/%{http_version} %{http_code}`n" https://localhost/
& $curl -sS -o NUL --tlsv1.1 --tls-max 1.1 --ciphers DEFAULT@SECLEVEL=0 --cacert C:\ProgramData\Apache24\server.crt https://localhost/ 2>&1 | ForEach-Object { "$_" }
HTTP/2 200
cache-control: no-store
content-type: text/html; charset=UTF-8
date: Thu, 03 Dec 2026 18:06:24 GMT
server: Apache

WAMP stack is running
Apache 2.4 served this page over HTTPS, and PHP 8.5 rendered it on Windows Server 2025.
PHP extensions loaded: 11 of 11 (mysqli, pdo_mysql, openssl, mbstring, curl, intl, gd, zip, sodium, fileinfo, exif)
OPcache: on

HTTP/1.1 301 Moved Permanently
Date: Thu, 03 Dec 2026 18:06:24 GMT
Server: Apache
Location: https://localhost/docs/?page=2
Content-Type: text/html; charset=iso-8859-1

TLS 1.3 -> HTTP/2 200
curl: (35) TLS connect error: error:0A00042E:SSL routines::tlsv1 alert protocol version
  • HTTPS answers 200 over HTTP/2. The headers carry no X-Powered-By, and the server header gives no version or operating system
  • The start page is index.php: PHP rendered it inside Apache, with all 11 extensions loaded and OPcache on
  • HTTP answers 301 with the same path and query on https://, so links and bookmarks to http:// keep working
  • TLS 1.3 works; TLS 1.1 is refused by the server ("protocol version"), even though curl offered it with every old cipher allowed

Windows PowerShell over Remote Desktop: HTTP/2 200 over HTTPS with server: Apache, the PHP page's lines with 11 of 11 extensions and OPcache on, a 301 redirect from http to https keeping the path, TLS 1.3 answering HTTP/2 200 and TLS 1.1 refused

Step 5: Open your site in a browser

From your own computer, browse to https://<public-ip>/ (or http://<public-ip>/, which takes you to HTTPS). Your browser warns that the connection is not private, or that the certificate is not trusted: the certificate is this VM's own self-signed one, which no browser trusts until you tell it to. That is expected until you use a certificate from a public certificate authority (Step 9).

Before you accept the warning, check it is your VM's certificate: open the certificate details from the browser's address bar and compare its SHA-256 fingerprint with the cert_sha256 value in C:\ProgramData\WAMP\cloudimg-firstboot.done (Step 3), or the SHA256Fingerprint line in C:\ProgramData\Apache24\apache-tls.txt.

The image's start page then shows where everything is:

The image's PHP start page in Microsoft Edge, on a machine that trusts this VM's certificate: WAMP stack is running, Apache 2.4 served it over HTTPS and PHP 8.5 rendered it, 11 of 11 extensions, OPcache on, MariaDB 11.8 on 127.0.0.1:3306 with its root password in wamp-credentials.txt, and the web root and settings files

Step 6: Sign in to MariaDB

The first boot of your VM gave MariaDB's root account a long random password of its own and wrote it to two files in C:\ProgramData\WAMP\, readable only by SYSTEM and the Administrators group:

  • wamp-credentials.txt: the host (127.0.0.1), port (3306), user name (root) and password, as MARIADB_...= lines, for you to read or copy into an application
  • mariadb-root.cnf: the same account as a MariaDB option file, so the mariadb client signs in without the password on the command line

To read the password, open C:\ProgramData\WAMP\wamp-credentials.txt in Notepad from an elevated window, or run Get-Content C:\ProgramData\WAMP\wamp-credentials.txt in an elevated PowerShell window. Keep it to yourself: it is this VM's own.

Sign in with the option file and look around:

(Get-Acl C:\ProgramData\WAMP\mariadb-root.cnf).Access | Format-Table IdentityReference, FileSystemRights -AutoSize
mariadb --defaults-extra-file=C:\ProgramData\WAMP\mariadb-root.cnf -t -e "SELECT VERSION(), @@bind_address, @@port, @@local_infile"
mariadb --defaults-extra-file=C:\ProgramData\WAMP\mariadb-root.cnf -t -e "SELECT User, Host FROM mysql.user ORDER BY User, Host"
mariadb --defaults-extra-file=C:\ProgramData\WAMP\mariadb-root.cnf -t -e "SHOW DATABASES"
IdentityReference      FileSystemRights
-----------------      ----------------
NT AUTHORITY\SYSTEM         FullControl
BUILTIN\Administrators      FullControl

+-----------------+----------------+--------+----------------+
| VERSION()       | @@bind_address | @@port | @@local_infile |
+-----------------+----------------+--------+----------------+
| 11.8.10-MariaDB | 127.0.0.1      |   3306 |              0 |
+-----------------+----------------+--------+----------------+

+-------------+-----------+
| User        | Host      |
+-------------+-----------+
| PUBLIC      |           |
| mariadb.sys | localhost |
| root        | 127.0.0.1 |
| root        | ::1       |
| root        | localhost |
+-------------+-----------+

+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
  • MariaDB is bound to 127.0.0.1 on port 3306, with LOAD DATA LOCAL off (@@local_infile 0)
  • root signs in only from this machine (localhost, 127.0.0.1 and ::1); there are no anonymous accounts. PUBLIC is MariaDB's built-in role and mariadb.sys its internal account, which cannot sign in
  • There is no test database

Windows PowerShell over Remote Desktop: mariadb-root.cnf readable by SYSTEM and Administrators only, MariaDB 11.8.10 bound to 127.0.0.1 on 3306 with local_infile 0, root only on localhost, 127.0.0.1 and ::1, and the four system databases

Step 7: PHP and MariaDB together

PHP's command line reads the same php.ini as Apache's PHP module. Check where it is, the extensions and the main settings, then have PHP sign in to MariaDB with the root account from the option file:

php --ini | Select-Object -First 2
php -m | Select-String -Pattern '^(curl|exif|fileinfo|gd|intl|mbstring|mysqli|openssl|pdo_mysql|sodium|zip|Zend OPcache)$' | ForEach-Object { $_.Line }
Select-String -Path 'C:\Program Files\PHP\php.ini' -Pattern '^(expose_php|display_errors|error_log|session.save_path|upload_max_filesize|opcache.enable) =' | Select-Object -Last 6 | ForEach-Object { $_.Line }
Set-Content $env:TEMP\dbtest.php '<?php $c = parse_ini_file("C:/ProgramData/WAMP/mariadb-root.cnf", true)["client"]; $m = new mysqli($c["host"], $c["user"], $c["password"], "", (int)$c["port"]); echo "PHP ", PHP_VERSION, " signed in to MariaDB ", $m->server_info, PHP_EOL;'
php $env:TEMP\dbtest.php; Remove-Item $env:TEMP\dbtest.php
Configuration File (php.ini) Path: ""
Loaded Configuration File:         "C:\Program Files\PHP\php.ini"

curl
exif
fileinfo
gd
intl
mbstring
mysqli
openssl
pdo_mysql
sodium
Zend OPcache
zip
Zend OPcache

expose_php = Off
display_errors = Off
error_log = "C:\ProgramData\PHP\logs\php-errors.log"
session.save_path = "C:\ProgramData\PHP\sessions"
upload_max_filesize = 64M
opcache.enable = 1

PHP 8.5.13 signed in to MariaDB 11.8.10-MariaDB

php -m lists OPcache twice because it is both a PHP module and a Zend extension. The test script is deleted straight after it runs, since it reads the root password; your application should use an account of its own (Step 8), not root.

Windows PowerShell over Remote Desktop: php.ini in C:\Program Files\PHP, the 11 extensions and Zend OPcache, expose_php and display_errors Off, the error log, sessions and upload settings, and PHP 8.5.13 signing in to MariaDB 11.8.10 through mysqli

Step 8: Create a database for your application

Give each application its own database and its own MariaDB account, limited to that database and to this machine. In an elevated PowerShell window, choose a strong password for the application (here <app-password>), then:

mariadb --defaults-extra-file=C:\ProgramData\WAMP\mariadb-root.cnf -e "CREATE DATABASE myapp CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'myapp'@'127.0.0.1' IDENTIFIED BY '<app-password>'; GRANT ALL PRIVILEGES ON myapp.* TO 'myapp'@'127.0.0.1';"

The command prints nothing when it succeeds. In your application's settings use:

Setting Value
Database host 127.0.0.1 (not localhost: the account is for the TCP address)
Port 3306
Database name myapp
User name myapp
Password the <app-password> you chose

Then put the application's files in the web root (Step 10) and follow its own installer.

Step 9: Use a certificate from a public certificate authority

For a public site, point a DNS name (for example www.example.com) at the VM's public IP address, and get a certificate for that name from a certificate authority. Apache needs two PEM files:

  • the certificate, followed by the authority's intermediate certificates in the same file (the "full chain")
  • the private key, unencrypted (a Windows service cannot ask for a passphrase)

Copy both into C:\ProgramData\Apache24\. A file copied into that folder takes the folder's permissions: SYSTEM and Administrators full control, and read for NT SERVICE\Apache2.4 only. Then open C:\Program Files\Apache24\conf\extra\httpd-cloudimg.conf in Notepad (as administrator), change the two certificate paths in the <VirtualHost _default_:443> section, and add your name:

<VirtualHost _default_:443>
    ServerName www.example.com
    ...
    SSLCertificateFile "C:/ProgramData/Apache24/www.example.com.crt"
    SSLCertificateKeyFile "C:/ProgramData/Apache24/www.example.com.key"
    ...

Use forward slashes in the paths, as Apache does on Windows. Check the configuration, then restart Apache:

& 'C:\Program Files\Apache24\bin\httpd.exe' -t 2>&1 | ForEach-Object { "$_" }
Restart-Service Apache2.4

If httpd -t reports a problem, fix it before restarting: Apache will not start with a configuration it cannot read. Renew the certificate before it expires, copy the renewed files over the old ones and restart Apache.

Step 10: Publish your site

The web root is C:\Program Files\Apache24\htdocs\. Replace the image's index.php start page there with your own site, or copy your PHP application in; Apache serves new files at once, with no restart, and looks for index.php before index.html. Directory listings are off, so a folder with no index file answers 403 Forbidden rather than showing its files.

httpd-cloudimg.conf in Notepad: PHP 8.5 loaded into Apache as a module with its php.ini folder, .php files handed to PHP, index.php first, TLS 1.2 and 1.3 only with the Mozilla intermediate ciphers, and the HTTP site redirecting every request to HTTPS

  • Apache: the server-wide settings are in C:\Program Files\Apache24\conf\httpd.conf; PHP's module, the HTTP and HTTPS sites and their TLS settings are in conf\extra\httpd-cloudimg.conf, shown above. After a change, run httpd -t, then Restart-Service Apache2.4
  • PHP: settings are in C:\Program Files\PHP\php.ini (for example memory_limit, upload_max_filesize and post_max_size); Apache reads them when it starts, so run Restart-Service Apache2.4 after a change. PHP's errors go to C:\ProgramData\PHP\logs\php-errors.log
  • MariaDB: settings are in C:\ProgramData\MariaDB\data\my.ini; run Restart-Service MariaDB after a change

The manuals: Apache at httpd.apache.org/docs/2.4, PHP at www.php.net/manual and MariaDB at mariadb.com/kb.

Step 11: Keeping Windows and the stack up to date

Windows: Windows Update is on, as in Microsoft's image. Check for updates in Settings > Windows Update, and plan restarts: Apache and MariaDB start again by themselves after a restart, and your site is unavailable while the VM restarts.

Apache: the Apache Software Foundation publishes new 2.4 releases at httpd.apache.org, and Apache Lounge publishes the Windows builds at www.apachelounge.com/download. Check a download's SHA-256 ((Get-FileHash .\<file>.zip -Algorithm SHA256).Hash) against the one on its download page, stop Apache, copy the new bin and modules folders over the old ones (leaving conf, htdocs and logs as they are), run httpd -t and start it again.

PHP: new 8.5 releases are at windows.php.net/download. Use the VS17 x64 Thread Safe zip (Apache loads the thread safe build), check its SHA-256, stop Apache, copy the new files over C:\Program Files\PHP\ (your php.ini is not in the zip, so it stays), and start Apache again.

MariaDB: new 11.8 releases are at mariadb.org/download. Back up your databases first (mariadb-dump), and follow MariaDB's upgrade notes for Windows.

Server Components

Component Version or setting Where
Apache HTTP Server 2.4.71 (Apache Lounge Win64 VS18 build) C:\Program Files\Apache24\bin\httpd.exe
PHP 8.5.13, thread safe (ZTS), VS17 x64, Apache module and command line C:\Program Files\PHP\
MariaDB Server 11.8.10 C:\Program Files\MariaDB 11.8\, data in C:\ProgramData\MariaDB\data
OpenSSL 3.5.9 (with Apache) C:\Program Files\Apache24\bin\
Apache service Apache2.4, NT SERVICE\Apache2.4, Automatic, restarted on failure Services
MariaDB service MariaDB, NT SERVICE\MariaDB, Automatic, restarted on failure Services
HTTPS port 443, HTTP/2 and HTTP/1.1, TLS 1.2 and 1.3, this VM's own certificate conf\extra\httpd-cloudimg.conf, C:\ProgramData\Apache24\
HTTP port 80, every request redirected (301) to HTTPS conf\extra\httpd-cloudimg.conf
MariaDB 127.0.0.1:3306 only C:\ProgramData\MariaDB\data\my.ini
Windows Server 2025 Datacenter, Desktop Experience, 24H2, build 26100.33828

Configuration

Apache reads C:\Program Files\Apache24\conf\httpd.conf, Apache's own file with mod_ssl, mod_socache_shmcb, mod_rewrite and mod_http2 loaded, no directory listings, the /cgi-bin/ alias off, ServerTokens Prod, ServerSignature Off and TraceEnable off, and at the end Include conf/extra/httpd-cloudimg.conf. That file loads PHP (LoadModule php_module, PHPIniDir, .php files handed to PHP, DirectoryIndex index.php index.html) and holds the HTTP and HTTPS sites.

PHP reads C:\Program Files\PHP\php.ini, PHP's own php.ini-production with, at the end: the 11 extensions and OPcache, expose_php = Off, display_errors = Off, errors logged to C:\ProgramData\PHP\logs\php-errors.log, uploads and temporary files in C:\ProgramData\PHP\tmp, sessions in C:\ProgramData\PHP\sessions with strict mode and Secure, HttpOnly and SameSite=Lax cookies, date.timezone = UTC, memory_limit = 256M, upload_max_filesize and post_max_size 64M, max_execution_time = 60 and allow_url_include = Off.

MariaDB reads C:\ProgramData\MariaDB\data\my.ini, written by MariaDB's own setup at the first boot, with cloudimg's lines added: bind-address=127.0.0.1, local-infile=0, max_allowed_packet=64M, innodb_buffer_pool_size=256M and, for clients, default-character-set=utf8mb4. Raise innodb_buffer_pool_size on a larger VM with a large database.

Filesystem Layout

Path What it holds
C:\Program Files\Apache24\ Apache: bin (httpd.exe, curl.exe, openssl.exe), modules, conf, htdocs (the web root), logs, manual
C:\Program Files\Apache24\logs\ ssl_access.log and ssl_error.log (HTTPS), access.log and error.log (HTTP), error_log (start-up and shut-down)
C:\Program Files\PHP\ PHP: php.exe, php8apache2_4.dll, ext\ and php.ini
C:\ProgramData\PHP\ tmp, sessions and logs (php-errors.log); NT SERVICE\Apache2.4 may change them
C:\Program Files\MariaDB 11.8\ MariaDB: bin (mariadb.exe, mariadb-dump.exe and the server)
C:\ProgramData\MariaDB\data\ MariaDB's databases and my.ini: SYSTEM, Administrators and NT SERVICE\MariaDB only
C:\ProgramData\Apache24\ This VM's server.key, server.crt and apache-tls.txt. SYSTEM and Administrators full control, NT SERVICE\Apache2.4 read
C:\ProgramData\WAMP\ wamp-credentials.txt, mariadb-root.cnf, wamp-firstboot.log and cloudimg-firstboot.done: SYSTEM and Administrators only

Managing the Services

From an elevated PowerShell window:

Restart-Service Apache2.4
Restart-Service MariaDB
Get-Service Apache2.4, MariaDB | Format-Table Name, Status, StartType -AutoSize

Stop-Service and Start-Service stop and start either one; to keep one stopped across restarts, also run Set-Service <name> -StartupType Disabled (and -StartupType Automatic to undo). If either stops unexpectedly, Windows restarts it.

The two Windows Firewall rules are in the group Apache HTTP Server; no rule opens MariaDB:

Get-NetFirewallRule -Group 'Apache HTTP Server' | Format-Table DisplayName, Enabled, Direction, Action -AutoSize

Who can reach ports 80 and 443 from the internet is decided by the VM's network security group in Azure (Step 1).

On Startup

At the first start of your VM, the scheduled task \cloudimg\WAMP first boot (SYSTEM) runs once:

  1. It waits until Windows setup and Azure have finished setting up the VM
  2. It checks C:\ProgramData\Apache24 and C:\ProgramData\WAMP have their locked-down permissions and hold no secret
  3. It makes PHP's tmp, sessions and logs folders
  4. It makes this VM's MariaDB instance in C:\ProgramData\MariaDB\data and the MariaDB service under NT SERVICE\MariaDB, bound to 127.0.0.1; gives root a random password of its own, removes anonymous accounts, root from other machines and the test database, and checks PHP's mysqli and PDO can sign in
  5. It makes this VM's 3072-bit RSA key and self-signed certificate (valid 825 days) and writes apache-tls.txt
  6. It checks Apache's configuration, starts Apache and checks it answers: HTTPS with exactly this certificate and the page PHP renders, and HTTP redirecting to HTTPS
  7. It writes wamp-credentials.txt and mariadb-root.cnf, sets Apache to Automatic, writes cloudimg-firstboot.done, then deletes its own task and script

What it did is in C:\ProgramData\WAMP\wamp-firstboot.log (readable by administrators; it never holds a password). It runs only once, so there is nothing to turn off. Every start after that, Windows starts both services with the same certificate and password.

Troubleshooting

The browser cannot reach the site

  • Check the VM's network security group allows ports 443 and 80 from your address (Step 1)
  • On the VM, check both services are running and listening (Step 3), and that https://localhost/ answers (Step 4)
  • A first boot takes a few minutes after the VM starts: until cloudimg-firstboot.done exists, Apache is not yet started

Apache will not start after a change

Run & 'C:\Program Files\Apache24\bin\httpd.exe' -t in an elevated PowerShell window: it names the file and line Apache cannot read. Then look at the end of C:\Program Files\Apache24\logs\error_log and ssl_error.log. A certificate and key that do not belong together, a key with a passphrase, or a broken php.ini line stop Apache from starting.

A PHP page shows a blank page or "500"

PHP does not show errors to visitors. Read the end of C:\ProgramData\PHP\logs\php-errors.log (Get-Content C:\ProgramData\PHP\logs\php-errors.log -Tail 20).

My application cannot connect to MariaDB

Use host 127.0.0.1 and port 3306, and an account made for '<user>'@'127.0.0.1' (Step 8). MariaDB does not accept connections from other machines; to reach it from your own computer, use an SSH or VPN tunnel to the VM rather than opening port 3306.

cloudimg-firstboot.done is missing

The first-boot task may still be running: give it a few minutes after the VM starts and check again. C:\ProgramData\WAMP\wamp-firstboot.log shows how far it got. A failure leaves the task in place, so it tries again at the next start.

Forgot the Windows password

Use Reset password on the VM's page in the Azure portal.

Security Recommendations

  • Keep Remote Desktop restricted to your own address (Step 1), or use Azure Bastion
  • Keep MariaDB on loopback. Never open port 3306 in the network security group
  • Give each application its own MariaDB account (Step 8); keep root for administration
  • Use a certificate from a public certificate authority for a public site (Step 9), and renew it before it expires
  • Keep server.key and wamp-credentials.txt on the VM, and never copy them into the web root
  • Keep Windows Update on, and update Apache, PHP and MariaDB when a release fixes a security issue (Step 11)

Support

cloudimg's support team is on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours, covering deployment, Remote Desktop access, Apache, PHP and MariaDB configuration, certificates and upgrades.

Apache and Apache HTTP Server are trademarks of The Apache Software Foundation. MariaDB is a trademark of MariaDB plc. PHP is a trademark of The PHP Group. Microsoft and Windows Server are trademarks of the Microsoft group of companies. All product and company names are trademarks or registered trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.