0

I installed the Statamic CMS, a PHP Lavarel-based CMS, in an Azure web app which is configured to use PHP 8.2. Because the CMS is built on Laravel, I needed to create a custom startup script for NGINX to change the startup file path from /home/site/wwwroot to /home/site/wwwroot/public as described in Step 5 of this Microsoft tutorial.

Everything worked fine the day I installed and configured the web site, however, the very next day I started getting a 403 Forbidden - NGINX/1.42.0 error and I can't figure-out why!?!?

enter image description here

I've combed the log stream on the app service and for the most part, it seems to indicate that the Linux VM is running and waiting for requests.

Any tips for troubleshooting this?

PoorInRichfield
  • 1,436
  • 2
  • 19
  • 29

1 Answers1

0

After hours of frustration, I found that Azure's Linux server VMs don't consistently implement the path to the NGINX startup file default.

On some VMs, the path to the default file is:

/etc/nginx/sites-available/default

On others, the path is:

/etc/nginx/sites-enabled/default

Since I'll have no idea which path is correct for the server my app is running on, I'm using the following Startup Command in the Azure web app's configuration to copy my custom startup script to both paths:

cp /home/site/wwwroot/default /etc/nginx/sites-available/default && /home/site/wwwroot/default /etc/nginx/sites-enabled/default && service nginx reload

PoorInRichfield
  • 1,436
  • 2
  • 19
  • 29