How to Fix 404 Not Found nginx/1.26.1 on App service

salman 20 Reputation points
2024-07-20T09:58:50.36+00:00

Hi,

I Create one Web App in App Server PHP 8.3, I Deploy the CakePHP Code

**.azurewebsites.net Default URL, When I load the Page Showing 404 Not Found nginx/1.26.1 Error in the web application

Once I load the **.azurewebsites.net URL It's redirect to **.azurewebsites.net/login

Need to Fix 404 issue '

Thanks

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

Accepted answer
  1. ajkuma 26,141 Reputation points Microsoft Employee
    2024-07-22T18:51:01.1366667+00:00

    salman, Apologies for the delayed response from over the weekend.

    Based on my understanding of your issue,

    Just to highlight, You may FTP or SSH into App Service - please checkout this doc for the steps. Open an SSH session to a container in Azure App Service

    You may also, navigate to your App Service via the Azure Portal.
    Under the Development Tools section, select SSH then Go -->.

    Modifying the default site config

    You will want to make a copy of the existing configuration and place the file inside the /home/site directory.

    cp
    

    Once copied, edit the /home/site/default file and update the section below:

    server
    

    Creating the custom startup script

    You will now need to create a custom startup script and save the file as /home/site/startup.sh

    #!/bin/bash
    

    In the custom startup script we are doing the following:

    1. Overriding the existing /etc/nginx/sites-enabled/default file with the /home/site/default file.
    2. Reloading the NGINX service to make the updates take effect.

    Ref: Checkout this article for more info:

    NGINX Rewrite Rules for Azure App Service Linux PHP 8.x

    Deploy your app to Azure App Service using FTP/S



    If the answer helped (pointed, you in the right direction) > please click Accept Answer to benefit the community find answers quickly to similar question.

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. akinbade abiola 17,050 Reputation points
    2024-07-20T10:22:28.31+00:00

    Hello Salman,

    Thanks for your question

    It might be looking for your application files in the wrong directory. Azure Web Apps look for the index.php file in the wwwroot folder. Make sure your CakePHP application's document root is set to wwwroot within your Azure configuration.

    If you confirmed this, you may need to review your nginx configs.

    See:

    https://video2.skills-academy.com/en-us/azure/app-service/quickstart-php?source=recommendations

    https://video2.skills-academy.com/en-us/iis/extensions/url-rewrite-module/url-rewrite-module-configuration-reference?hl=en-US

    If the above information was useful, please remember to Mark 'Accept Answer'

    0 comments No comments

  2. salman 20 Reputation points
    2024-07-20T14:33:44.75+00:00

    Hi,

    How to deploy CakePHP web application in Azure app service using FTP ( Filezilla )?

    Below images our code folder structure.

    Screenshot 2024-07-20 200107

    Screenshot 2024-07-20 200134

    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.