404 Not Found - nginx/1.24.0 for PHP Codeigniter in Azure App Service

Venkatesh 0 Reputation points
2024-01-03T15:27:33.38+00:00

I am trying to host PHP 8.2 site in azure web app but it is constantly giving me 404 Not found.

I tried the following:

  1. Server name updated to <webapp>.azurewebsites.net
  2. PHP Version and PHP-FPM version validated.
  3. Startup Script is added to configuration setting to copy the default file during restart
  4. it works for simple index.php file but not for codeigniter code base

Help is highly appreciated

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,162 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 27,881 Reputation points Microsoft Employee
    2024-01-04T09:49:01.4533333+00:00

    @Venkatesh, Thanks for posting this question. I understand you have tried multiple steps to narrow down the issue.

    There may be certain situations in which 404s appear - this typically falls into the three below categories:

    • A 404 due to actual missing content or an unmapped endpoint (e.g. file not found, Controller is not mapped to the endpoint/path name, etc.)
    • A 404 due to a HTTP 500
    • A 404 due to site root misconfiguration

    Just to highlight, CodeIgniter serves content out of its /public directory. NGINX on App Service Linux uses its site root as /home/site/wwwroot.

    I understand you have added the startup script, since PHP 8.x uses NGINX as a default Web Server - you will need to use a custom startup script to serve CodeIgniters content out of /public - PHP- Configuration - Custom Startup Script  (Kindly review this)

    Does this work locally? 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.

    Enable App Service Logging and then reviewing application logs to fetch more info about the error.

    Refer these docs for more info:

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.