Making ProcessWire Work on Azure After Deployment

Daniel Njoku
3 min readMay 9, 2024

--

processwire_on_azure

ProcessWire is a robust open-source content management system (CMS) and web application framework built on PHP. While it can be deployed on Microsoft Azure’s App Service, there are specific configuration steps required to ensure it functions correctly, especially when running on the Linux-based App Service with PHP 8.x.

The Challenge: Nginx Configuration

One of the primary challenges in running ProcessWire on Azure App Service (Linux) is that the default Nginx configuration may not work seamlessly with ProcessWire out-of-the-box. This is because ProcessWire utilizes clean URLs and requires specific URL rewriting rules to operate properly.

To address this issue, you need to modify the Nginx configuration file to include the necessary rewrite rules and instruct the App Service to use this custom configuration.

Step-by-Step Configuration

Follow these steps to configure ProcessWire on Azure App Service (Linux) with PHP 8.x:

1. Copy Default Nginx Configuration

  1. Connect to the App Service via SSH: https://<AppServiceName>.scm.azurewebsites.net/webssh/host
  2. Copy the default Nginx configuration to the /home folder:
    cp /etc/nginx/sites-enabled/default /home/default

2. Modify Nginx Configuration

3. Edit the copied configuration file: vi /home/default

4. Add the following rewrite rules within the server block:

absolute_redirect off;

location / {
try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
}

These rules allow ProcessWire to handle clean URLs and pass PHP files to PHP-FPM correctly.

3. Set Custom Startup Script

5. Create a startup script to overwrite the default Nginx configuration:
vi /home/startup.sh

6. Add the following lines to the script:

#!/bin/bash
cp /home/default /etc/nginx/sites-enabled/default
service nginx reload

7. Make the script executable: chmod +x /home/startup.sh

4. Configure App Service

8. In the Azure portal, navigate to your App Service > Configuration > General Settings

9. Under “Startup Command”, enter /home/startup.sh

This will copy your custom Nginx configuration and reload Nginx on every App Service restart, enabling ProcessWire to run properly with PHP 8.x on Azure App Service.

Performance Considerations

While ProcessWire can run on Azure App Service, some users have reported performance issues, particularly when running on Windows-based App Services with IIS. To mitigate potential performance problems, consider the following:

  • Use the Linux-based App Service instead of the Windows-based one, as the former is optimized for PHP applications.
  • Ensure that you have allocated sufficient resources (CPU and RAM) to your App Service instance.
  • Avoid using the Bitnami installer, as it can be more resource-intensive and expensive to run.
  • Optimize your ProcessWire installation and the website’s code for better performance.

Deployment Options

For Windows-based App Services, pre-configured ProcessWire offerings are available on the Azure Marketplace, simplifying the deployment process.

For Linux-based App Services, you can upload the ProcessWire files to the App Service and follow the Nginx configuration steps outlined above to ensure it works correctly.

By following these steps, you can successfully deploy and configure ProcessWire to run on Azure App Service, leveraging the scalability, high availability, and managed services offered by Microsoft’s cloud platform.

Kindly let me know if this solves your need.

Reference: Configure Nginx for PHP 8 Linux Azure App Service — Microsoft Community Hub

--

--

Daniel Njoku

Developer/Technical Writer/Support Engineer/QA/A.I Enthusiast/Data Engineer and analytics