Deploying a Web App on Azure App Service: A Comprehensive Guide
May 1, 2025Bringing the Cloud to Your Cause: A Nonprofit’s Guide to the Microsoft Cloud Adoption Framework
May 1, 2025Encountering an error due to host restrictions on file sizes exceeding 50 MB can be frustrating, especially for nonprofits using WordPress on Azure. This article provides detailed instructions on how to resolve this issue effectively.
Understanding the Error
When you try to upload a file larger than 50 MB, you might encounter errors such as Request body too large or HTTP 502. These errors occur because Azure imposes limits on the size of files that can be uploaded to its services.
Steps to Resolve the Issue
- Log into the Azure Portal
- Access the Azure portal by navigating to portal.azure.com.
- Use the search bar at the top of the portal to search for “App Services”.
- From the list of App Services, select the one associated with your application.
- SSH into the App Service:
- Scroll down to the Development Tools section in the left-hand menu.
- Select SSH to open an SSH session directly in the Azure portal.
- Click Go to connect to the web-based console interface of your app.
- Adjust App Service Settings:
- Use the following command to create a .user.ini file in the wwwroot directory:
nano /home/site/wwwroot/.user.ini - Add the following lines to the file. For Windows, use Control + Shift + V to paste inside the nano editor:
upload_max_filesize = 1024M
post_max_size = 1024M
- For Windows, press Control + X to exit the nano editor.
- Press Y to confirm saving the changes.
- Press Enter to save the file.
- Use the following command to create a .user.ini file in the wwwroot directory:
- Check Your WordPress Site
- go into your wp-admin page
- Select Media then add Media then you will notice that the upload file has been changed
- Revert the Change:
- To revert the change, return to the Azure Web App command line and use the following command:
rm /home/site/wwwroot/.user.ini
- To revert the change, return to the Azure Web App command line and use the following command:
Conclusion
By following these steps, nonprofits using WordPress on Azure can effectively resolve host restrictions on file sizes exceeding 50 MB, ensuring smoother file uploads and better application performance.