@V1xIII , Apologies for the delayed response here.
I understand you have tried multiples steps to isolate the issue. Kindly try these steps to further isolate the issue. Sorry for the long post, just sharing essential pointers based on your scenario.
--If you haven't done, override NGINX’s configuration by following this post (depending on the app framework) or if using frameworks that serve content out of a different directory, like Laravel - mod
The .php
file must be relative to where root is set. For example, root may be set to/home/site/wwwroot/public
- this index.php
file must be under this directory.
--For .js
files that may be apart of Front-Ends ( example using Vue, React, Angular, or others (being served as production builds to PHP - eg., Laravel and Yii, etc.) , ensure these are on the file system. If not, then the frontends for these may not be built during deployment. Kindly check if npm run build
or yarn run build
is expected to be ran or if the production build folder is set in a .gitignore
.
--HTTP 404’s can come back from NGINX if site root does not match where the application root is. This is defined in the default.conf
file under sites-available
with the root
directive.
A common theme is with frameworks again - such as Laravel and Yii - where the application is served out of /public/
or /web/
- which would equate to /home/site/wwwwroot/public
or /home/site/wwwroot/web
- whereas NGINX’s default root
is /home/site/wwwroot
.
-nginx.conf: This lives under /etc/nginx/nginx.conf
- Copy
/etc/nginx/conf.d/default.conf
to/home/dev
.
copy of the file will exist as/home/dev/default.conf
- Edit the existing startup fie in
/home/dev/startup.sh
to include the following:
echo "Copying custom default.conf over to /etc/nginx/conf.d/default.conf"
cp /home/dev/default.conf /etc/nginx/conf.d/default
nginx -s reload
--For 404’s due to endpoints not mapped to controllers, kindly check the source code to ensure these endpoints actually exist in their codebase. This will also depend on the framework used.
--If App Service Logging is enabled , but debug mode is not enabled - the logging may only just show this - and not anything like a error/callstack written to stdout/err:
[ERROR] 127.0.0.1 - 10/Jun/2024:13:16:13 +0000 "GET /index.php"
- Enable application logging (Linux/Container) to fetch more details.
- NGINX Rewrite Rules for Azure App Service Linux PHP 8.x -
If the answer helped (pointed, you in the right direction) > please click Accept Answer - it will benefit community members to find the answers quickly.